Skip to content

Commit 9473349

Browse files
[clang] Use llvm::SmallVector::pop_back_val (NFC) (#136451)
1 parent 1cf188a commit 9473349

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

clang/lib/Analysis/CFG.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -6258,8 +6258,7 @@ bool CFGBlock::isInevitablySinking() const {
62586258

62596259
DFSWorkList.push_back(StartBlk);
62606260
while (!DFSWorkList.empty()) {
6261-
const CFGBlock *Blk = DFSWorkList.back();
6262-
DFSWorkList.pop_back();
6261+
const CFGBlock *Blk = DFSWorkList.pop_back_val();
62636262
Visited.insert(Blk);
62646263

62656264
// If at least one path reaches the CFG exit, it means that control is

clang/lib/Basic/Module.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ void Module::markUnavailable(bool Unimportable) {
334334
SmallVector<Module *, 2> Stack;
335335
Stack.push_back(this);
336336
while (!Stack.empty()) {
337-
Module *Current = Stack.back();
338-
Stack.pop_back();
337+
Module *Current = Stack.pop_back_val();
339338

340339
if (!needUpdate(Current))
341340
continue;

clang/lib/Driver/Driver.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2812,8 +2812,7 @@ void Driver::BuildUniversalActions(Compilation &C, const ToolChain &TC,
28122812

28132813
// Verify the debug info output.
28142814
if (Args.hasArg(options::OPT_verify_debug_info)) {
2815-
Action* LastAction = Actions.back();
2816-
Actions.pop_back();
2815+
Action *LastAction = Actions.pop_back_val();
28172816
Actions.push_back(C.MakeAction<VerifyDebugInfoJobAction>(
28182817
LastAction, types::TY_Nothing));
28192818
}

clang/lib/Sema/AnalysisBasedWarnings.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ static bool throwEscapes(Sema &S, const CXXThrowExpr *E, CFGBlock &ThrowBlock,
313313
Queued[ThrowBlock.getBlockID()] = true;
314314

315315
while (!Stack.empty()) {
316-
CFGBlock &UnwindBlock = *Stack.back();
317-
Stack.pop_back();
316+
CFGBlock &UnwindBlock = *Stack.pop_back_val();
318317

319318
for (auto &Succ : UnwindBlock.succs()) {
320319
if (!Succ.isReachable() || Queued[Succ->getBlockID()])

clang/lib/Sema/ParsedAttr.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ void *AttributeFactory::allocate(size_t size) {
5454
// Check for a previously reclaimed attribute.
5555
size_t index = getFreeListIndexForSize(size);
5656
if (index < FreeLists.size() && !FreeLists[index].empty()) {
57-
ParsedAttr *attr = FreeLists[index].back();
58-
FreeLists[index].pop_back();
57+
ParsedAttr *attr = FreeLists[index].pop_back_val();
5958
return attr;
6059
}
6160

clang/lib/Sema/SemaHLSL.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -3375,8 +3375,7 @@ static bool BuildInitializerList(Sema &S, ASTContext &Ctx, Expr *E,
33753375
RecordTypes.push_back(D->bases_begin()->getType()->getAs<RecordType>());
33763376
}
33773377
while (!RecordTypes.empty()) {
3378-
const RecordType *RT = RecordTypes.back();
3379-
RecordTypes.pop_back();
3378+
const RecordType *RT = RecordTypes.pop_back_val();
33803379
for (auto *FD : RT->getDecl()->fields()) {
33813380
DeclAccessPair Found = DeclAccessPair::make(FD, FD->getAccess());
33823381
DeclarationNameInfo NameInfo(FD->getDeclName(), E->getBeginLoc());
@@ -3424,8 +3423,7 @@ static Expr *GenerateInitLists(ASTContext &Ctx, QualType Ty,
34243423
RecordTypes.push_back(D->bases_begin()->getType()->getAs<RecordType>());
34253424
}
34263425
while (!RecordTypes.empty()) {
3427-
const RecordType *RT = RecordTypes.back();
3428-
RecordTypes.pop_back();
3426+
const RecordType *RT = RecordTypes.pop_back_val();
34293427
for (auto *FD : RT->getDecl()->fields()) {
34303428
Inits.push_back(GenerateInitLists(Ctx, FD->getType(), It));
34313429
}

0 commit comments

Comments
 (0)