[clang] Use llvm::SmallVector::pop_back_val (NFC)#136451
Merged
kazutakahirata merged 1 commit intoApr 19, 2025
Merged
Conversation
Member
|
@llvm/pr-subscribers-hlsl @llvm/pr-subscribers-clang-analysis Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136451.diff 6 Files Affected:
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));
}
|
Member
|
@llvm/pr-subscribers-clang-driver Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136451.diff 6 Files Affected:
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));
}
|
Member
|
@llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136451.diff 6 Files Affected:
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));
}
|
kuhar
approved these changes
Apr 19, 2025
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/12232 Here is the relevant piece of the build log for the reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.