[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 18 09:07:34 PDT 2020


aeubanks added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2110
+def warn_uninit_const_reference : Warning<
+  "variable %0 is uninitialized when passes as a const reference parameter "
+  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
----------------
s/passes/passed


================
Comment at: clang/test/SemaCXX/warn-uninitialized-const-reference.cpp:23
+    int k = const_use(k); // expected-warning {{variable 'k' is uninitialized when used within its own initialization}}
+    A a2 = const_use_A(a2); // expected-warning {{variable 'a2' is uninitialized when used within its own initialization}}
+    A a3(const_ref_use_A(a3)); // expected-warning {{variable 'a3' is uninitialized when passes as a const reference parameter here}}
----------------
For my knowledge, is this to make sure that this other warning takes precedence over the one introduced in this change? If it is, a comment would be nice.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895





More information about the cfe-commits mailing list