-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[clang] Use llvm::SmallVector::pop_back_val (NFC) #136451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang] Use llvm::SmallVector::pop_back_val (NFC) #136451
Conversation
@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));
}
|
@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));
}
|
@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));
}
|
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
|
No description provided.