================
@@ -0,0 +1,51 @@
+// RUN: %clang_analyze_cc1 
-analyzer-checker=core,debug.ExprInspection,alpha.core.DanglingPtrDeref 
-analyzer-config cfg-lifetime=true -analyzer-output=text -verify %s
+
+void clang_analyzer_warnIfReached();
+
+// Enabling CFG lifetime-end elements should not cause regression in the
+// path notes. The loop exit path note must point to the next executed
+// statmeent and not back to the loop.
+void testPathNotesWithLoopScopeEnd() {
+  int *p = nullptr;
+  for (int i = 0; i < 3; ++i) {
+  // expected-note@-1 3 {{Loop condition is true.  Entering loop body}}
+  // expected-note@-2   {{The value 2 is assigned to 'i'}}
+  // expected-note@-3   {{Loop condition is false. Execution continues on line 
17}}
+    p = &i; // expected-note {{Value assigned to 'p'}}
+  }
+  // expected-note@-1 {{'i' is destroyed here}}
----------------
necto wrote:

I think whenever you have the opportunity it is more readable to put the 
expectation onto the same line
```suggestion
  } // expected-note {{'i' is destroyed here}}
```

https://github.com/llvm/llvm-project/pull/228045
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to