================
@@ -0,0 +1,38 @@
+// RUN: %clang_analyze_cc1 -xc %s \
+// RUN: -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN: -verify
+// RUN: %clang_analyze_cc1 -xc++ %s \
+// RUN: -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN: -verify -w
+
+// Self assignment initialization in C code will be treated as nop.
+// We will not report the VarDecl, but the following DeclRefExpr if it has not
+// yet been initialized then.
+
+void clang_analyzer_warnIfReached();
+
+struct S { int x; };
+union U { int x; };
+
+void nowarn() {
+ int x = x; // no-warnings for C/C++
+ int *p = p; // no-warnings for C/C++
+ struct S s = s; // no-warning for C, but C++ will not report
+ union U u = u; // no-warning for C, but C++ will not report
----------------
steakhal wrote:
These comments look confusing to me. The words `but` implies that some aspect
is the opposite in the second half of the sentence than in the first half -
however, both sides describe the case when we don't report. So what's up with
this?
https://github.com/llvm/llvm-project/pull/187530
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits