================
@@ -0,0 +1,75 @@
+// DEFINE: %{run} = %clang_analyze_cc1 \
+// DEFINE: -analyzer-checker=core,optin.cplusplus.UninitializedObject \
+// DEFINE: -analyzer-output=text -fno-caret-diagnostics %s
+
+// RUN: %{run} -verify
+// RUN: %{run} 2>&1 | FileCheck %s
+
+struct MultipleSiblings {
+ int a; // expected-note {{uninitialized field 'this->a'}}
+ int b; // expected-note {{uninitialized field 'this->b'}}
+ int c; // expected-note {{uninitialized field 'this->c'}}
+ int d;
+ MultipleSiblings() { d = 0; }
+ // expected-warning@-1 {{3 uninitialized fields}}
+ // expected-note@-2 {{3 uninitialized fields}}
+};
+
+void fMultipleSiblings() {
+ MultipleSiblings s; // expected-note {{Calling default constructor for
'MultipleSiblings'}}
+}
+
+// CHECK-LABEL: warning: 3 uninitialized fields at the end of the constructor
call
+// CHECK-NEXT: note: uninitialized field 'this->a'
+// CHECK-NEXT: note: uninitialized field 'this->b'
+// CHECK-NEXT: note: uninitialized field 'this->c'
----------------
necto wrote:
It took me a short moment in the context of the PR to understand the need for
these CHECKs. I'm afraid later it might be confusing, I think it would help to
have a comment explaining that it is the way to assert the order of the notes.
https://github.com/llvm/llvm-project/pull/214208
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits