================
@@ -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
----------------
NagyDonat wrote:

The comments on these lines are confusing and suspicious. Did you mean to write 
"C++ will report"?

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

Reply via email to