[clang] 9473349 - [clang] Use llvm::SmallVector::pop_back_val (NFC) (#136451)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 19 13:35:21 PDT 2025
Author: Kazu Hirata
Date: 2025-04-19T13:35:18-07:00
New Revision: 94733492b720c2e65a8fe9bd2179a35a7b7d9916
URL: https://github.com/llvm/llvm-project/commit/94733492b720c2e65a8fe9bd2179a35a7b7d9916
DIFF: https://github.com/llvm/llvm-project/commit/94733492b720c2e65a8fe9bd2179a35a7b7d9916.diff
LOG: [clang] Use llvm::SmallVector::pop_back_val (NFC) (#136451)
Added:
Modified:
clang/lib/Analysis/CFG.cpp
clang/lib/Basic/Module.cpp
clang/lib/Driver/Driver.cpp
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/lib/Sema/ParsedAttr.cpp
clang/lib/Sema/SemaHLSL.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 9af1e915482da..d03a0a544b016 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -6258,8 +6258,7 @@ bool CFGBlock::isInevitablySinking() const {
DFSWorkList.push_back(StartBlk);
while (!DFSWorkList.empty()) {
- const CFGBlock *Blk = DFSWorkList.back();
- DFSWorkList.pop_back();
+ const CFGBlock *Blk = DFSWorkList.pop_back_val();
Visited.insert(Blk);
// If at least one path reaches the CFG exit, it means that control is
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index bb85a4010931f..6330bfe9418e8 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -334,8 +334,7 @@ void Module::markUnavailable(bool Unimportable) {
SmallVector<Module *, 2> Stack;
Stack.push_back(this);
while (!Stack.empty()) {
- Module *Current = Stack.back();
- Stack.pop_back();
+ Module *Current = Stack.pop_back_val();
if (!needUpdate(Current))
continue;
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 90d8e823d1d02..2a51ac2e9f0b9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2812,8 +2812,7 @@ void Driver::BuildUniversalActions(Compilation &C, const ToolChain &TC,
// Verify the debug info output.
if (Args.hasArg(options::OPT_verify_debug_info)) {
- Action* LastAction = Actions.back();
- Actions.pop_back();
+ Action *LastAction = Actions.pop_back_val();
Actions.push_back(C.MakeAction<VerifyDebugInfoJobAction>(
LastAction, types::TY_Nothing));
}
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index 34045a7274021..32c7ee92466ad 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -313,8 +313,7 @@ static bool throwEscapes(Sema &S, const CXXThrowExpr *E, CFGBlock &ThrowBlock,
Queued[ThrowBlock.getBlockID()] = true;
while (!Stack.empty()) {
- CFGBlock &UnwindBlock = *Stack.back();
- Stack.pop_back();
+ CFGBlock &UnwindBlock = *Stack.pop_back_val();
for (auto &Succ : UnwindBlock.succs()) {
if (!Succ.isReachable() || Queued[Succ->getBlockID()])
diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp
index ba12a5aae5773..4e4859d538cd6 100644
--- a/clang/lib/Sema/ParsedAttr.cpp
+++ b/clang/lib/Sema/ParsedAttr.cpp
@@ -54,8 +54,7 @@ void *AttributeFactory::allocate(size_t size) {
// Check for a previously reclaimed attribute.
size_t index = getFreeListIndexForSize(size);
if (index < FreeLists.size() && !FreeLists[index].empty()) {
- ParsedAttr *attr = FreeLists[index].back();
- FreeLists[index].pop_back();
+ ParsedAttr *attr = FreeLists[index].pop_back_val();
return attr;
}
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 65f3275b3469f..d725eb4b2fe6c 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -3375,8 +3375,7 @@ static bool BuildInitializerList(Sema &S, ASTContext &Ctx, Expr *E,
RecordTypes.push_back(D->bases_begin()->getType()->getAs<RecordType>());
}
while (!RecordTypes.empty()) {
- const RecordType *RT = RecordTypes.back();
- RecordTypes.pop_back();
+ const RecordType *RT = RecordTypes.pop_back_val();
for (auto *FD : RT->getDecl()->fields()) {
DeclAccessPair Found = DeclAccessPair::make(FD, FD->getAccess());
DeclarationNameInfo NameInfo(FD->getDeclName(), E->getBeginLoc());
@@ -3424,8 +3423,7 @@ static Expr *GenerateInitLists(ASTContext &Ctx, QualType Ty,
RecordTypes.push_back(D->bases_begin()->getType()->getAs<RecordType>());
}
while (!RecordTypes.empty()) {
- const RecordType *RT = RecordTypes.back();
- RecordTypes.pop_back();
+ const RecordType *RT = RecordTypes.pop_back_val();
for (auto *FD : RT->getDecl()->fields()) {
Inits.push_back(GenerateInitLists(Ctx, FD->getType(), It));
}
More information about the cfe-commits
mailing list