Skip to content

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLocalVarsChecker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class RawPtrRefLocalVarsChecker
269269
if (tryToFindPtrOrigin(
270270
Value, /*StopAtFirstRefCountedObj=*/false,
271271
[&](const clang::Expr *InitArgOrigin, bool IsSafe) {
272-
if (!InitArgOrigin)
272+
if (!InitArgOrigin || IsSafe)
273273
return true;
274274

275275
if (isa<CXXThisExpr>(InitArgOrigin))

‎clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,12 @@ int TreeNode::recursiveWeight() {
456456
}
457457

458458
} // namespace local_var_in_recursive_function
459+
460+
namespace local_var_for_singleton {
461+
RefCountable *singleton();
462+
RefCountable *otherSingleton();
463+
void foo() {
464+
RefCountable* bar = singleton();
465+
RefCountable* baz = otherSingleton();
466+
}
467+
}

0 commit comments

Comments
 (0)
Please sign in to comment.