Skip to content

Commit 674befc

Browse files
committed
skipPurge unconditionally
1 parent 4555ae3 commit 674befc

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
278278
/// Useful for explaining control flow that follows the current node.
279279
/// If the statement belongs to a body-farmed definition, retrieve the
280280
/// call site for that definition.
281-
/// If skipPurge is true, skip the purge-dead-symbols nodes (that are often
282-
/// inserted out-of-order by the endinge).
283-
const Stmt *getNextStmtForDiagnostics(bool skipPurge) const;
281+
const Stmt *getNextStmtForDiagnostics() const;
284282

285283
/// Find the statement that was executed immediately before this node.
286284
/// Useful when the node corresponds to a CFG block entrance.

clang/lib/StaticAnalyzer/Core/BugReporter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static void removePiecesWithInvalidLocations(PathPieces &Pieces) {
590590
PathDiagnosticLocation PathDiagnosticBuilder::ExecutionContinues(
591591
const PathDiagnosticConstruct &C) const {
592592
if (const Stmt *S =
593-
C.getCurrentNode()->getNextStmtForDiagnostics(/*skipPurge=*/true))
593+
C.getCurrentNode()->getNextStmtForDiagnostics())
594594
return PathDiagnosticLocation(S, getSourceManager(),
595595
C.getCurrLocationContext());
596596

@@ -883,8 +883,7 @@ void PathDiagnosticBuilder::generateMinimalDiagForBlockEdge(
883883

884884
case Stmt::GotoStmtClass:
885885
case Stmt::IndirectGotoStmtClass: {
886-
if (const Stmt *S = C.getCurrentNode()->getNextStmtForDiagnostics(
887-
/*skipPurge=*/false))
886+
if (const Stmt *S = C.getCurrentNode()->getNextStmtForDiagnostics())
888887
C.getActivePath().push_front(generateDiagForGotoOP(C, S, Start));
889888
break;
890889
}
@@ -2432,7 +2431,7 @@ findReasonableStmtCloseToFunctionExit(const ExplodedNode *N) {
24322431
if (exitingDestructor(N)) {
24332432
// If we are exiting a destructor call, it is more useful to point to
24342433
// the next stmt which is usually the temporary declaration.
2435-
if (const Stmt *S = N->getNextStmtForDiagnostics(/*skipPurge=*/false))
2434+
if (const Stmt *S = N->getNextStmtForDiagnostics())
24362435
return S;
24372436
// If next stmt is not found, it is likely the end of a top-level
24382437
// function analysis. find the last execution statement then.
@@ -2460,7 +2459,7 @@ PathSensitiveBugReport::getLocation() const {
24602459
S = findReasonableStmtCloseToFunctionExit(ErrorNode);
24612460
}
24622461
if (!S)
2463-
S = ErrorNode->getNextStmtForDiagnostics(/*skipPurge=*/false);
2462+
S = ErrorNode->getNextStmtForDiagnostics();
24642463
}
24652464

24662465
if (S) {

clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ const Stmt *ExplodedNode::getStmtForDiagnostics() const {
347347
return nullptr;
348348
}
349349

350-
const Stmt *ExplodedNode::getNextStmtForDiagnostics(bool skipPurge) const {
350+
const Stmt *ExplodedNode::getNextStmtForDiagnostics() const {
351351
for (const ExplodedNode *N = getFirstSucc(); N; N = N->getFirstSucc()) {
352-
if (skipPurge && N->getLocation().isPurgeKind())
352+
if (N->getLocation().isPurgeKind())
353353
continue;
354354
if (const Stmt *S = N->getStmtForDiagnostics()) {
355355
// Check if the statement is '?' or '&&'/'||'. These are "merges",

clang/test/Analysis/copy-elision.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@ void testVariable() {
263263

264264
struct TestCtorInitializer {
265265
ClassWithDestructor c;
266-
TestCtorInitializer(AddressVector<ClassWithDestructor> &v)
267-
: c(ClassWithDestructor(v)) {}
268-
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
269-
object of type 'ClassWithDestructor' is still referred \
270-
to by the caller variable 'v' upon returning to the caller}}
266+
TestCtorInitializer(AddressVector<ClassWithDestructor> &refParam)
267+
: c(ClassWithDestructor(refParam)) {}
271268
};
272269

273270
void testCtorInitializer() {
274271
AddressVector<ClassWithDestructor> v;
275272
{
276273
TestCtorInitializer t(v);
274+
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
275+
object of type 'ClassWithDestructor' is still referred \
276+
to by the caller variable 'v' upon returning to the caller}}
277277
// Check if the last destructor is an automatic destructor.
278278
// A temporary destructor would have fired by now.
279279
#if ELIDE

0 commit comments

Comments
 (0)