-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[analyzer] Fix use after scope after #123003 #128372
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
[analyzer] Fix use after scope after #123003 #128372
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-clang-static-analyzer-1 Author: Vitaly Buka (vitalybuka) ChangesIn #123003 make_first_range was applied to temporarily. Full diff: https://github.com/llvm/llvm-project/pull/128372.diff 1 Files Affected:
diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index 48fa0ebbfc609..3aafb5384b3a6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -203,8 +203,8 @@ void StackAddrEscapeChecker::checkAsyncExecutedBlockCaptures(
// a variable of the type "dispatch_semaphore_t".
if (isSemaphoreCaptured(*B.getDecl()))
return;
- for (const MemRegion *Region :
- llvm::make_first_range(getCapturedStackRegions(B, C))) {
+ auto Regions = getCapturedStackRegions(B, C);
+ for (const MemRegion *Region : llvm::make_first_range(Regions)) {
// The block passed to dispatch_async may capture another block
// created on the stack. However, there is no leak in this situaton,
// no matter if ARC or no ARC is enabled:
|
@llvm/pr-subscribers-clang Author: Vitaly Buka (vitalybuka) ChangesIn #123003 make_first_range was applied to temporarily. Full diff: https://github.com/llvm/llvm-project/pull/128372.diff 1 Files Affected:
diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index 48fa0ebbfc609..3aafb5384b3a6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -203,8 +203,8 @@ void StackAddrEscapeChecker::checkAsyncExecutedBlockCaptures(
// a variable of the type "dispatch_semaphore_t".
if (isSemaphoreCaptured(*B.getDecl()))
return;
- for (const MemRegion *Region :
- llvm::make_first_range(getCapturedStackRegions(B, C))) {
+ auto Regions = getCapturedStackRegions(B, C);
+ for (const MemRegion *Region : llvm::make_first_range(Regions)) {
// The block passed to dispatch_async may capture another block
// created on the stack. However, there is no leak in this situaton,
// no matter if ARC or no ARC is enabled:
|
Ah, I wish we had C++23 already. That would have fixed this too. Thanks! |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/81/builds/5023 Here is the relevant piece of the build log for the reference
|
In #123003 make_first_range was applied to temporarily.