================
@@ -0,0 +1,33 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify
%s
+// expected-no-diagnostics
+
+void clang_analyzer_warnIfReached();
+
+// Forward declaration
+namespace N { // 1st
+template <class T> struct Wrapper;
----------------
steakhal wrote:
AH, I see now the source of confusion. You are right that `1st` was an
unfortunate way of phrasing that the DeclWithIssue would be replaced by that
thing as the first time it's changed. Then changed again, etc.
If I trace what the DeclWithIssue refers to initially and then changed later in
the loop, it would print this without the proposed fix:
```
DeclWithIssue initially was 0xacad0d4d0 CXXMethod
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:22:3
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:27:3
DeclWithIssue was changed to 0xacad0d220 ClassTemplateSpecialization
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:13:1
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:13:27
DeclWithIssue was changed to 0xacad021b8 Namespace
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:12:1
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:17:1
```
With my proposed fix, it would be this one:
```
DeclWithIssue initially was 0x8bacfd4d0 CXXMethod
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:22:3
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:27:3
DeclWithIssue was changed to 0x8bacfd220 ClassTemplateSpecialization
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:13:1
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:13:27
DeclWithIssue was changed to 0x8bacf6888 Namespace
begin: clang/test/Analysis/suppress-namespace-redecl-core.cpp:20:1
end: clang/test/Analysis/suppress-namespace-redecl-core.cpp:29:1
```
https://github.com/llvm/llvm-project/pull/178441
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits