[clang] [clang][analyzer] Improved message in uninitialized.Assign at default assignment (PR #208173)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 9 03:08:03 PDT 2026
================
@@ -162,4 +167,11 @@ namespace SynthesizedAssignment {
clang_analyzer_eval(u.a[2].a == 43); // expected-warning{{TRUE}}
// expected-note at -1{{TRUE}}
}
+
+ void testImplicitAssign() {
+ C c1, c2;
+ c1 = c2; // expected-warning at 114{{Value assigned to field 'x' in implicit assignment operator is uninitialized}}
----------------
steakhal wrote:
I'd highly advise against using Line numbers for pinning messages.
I think you have two options:
1) Just put the expectation there, or
2) Leave anchor there and associate the expectation agains that for example: `// #fany-anchor` and then later `// expected-warning@#fany-anchor {{Fancy message}}`
I'd probably prefer option 2, and use the test entry point name as the anchor to make them correlate.
https://github.com/llvm/llvm-project/pull/208173
More information about the cfe-commits
mailing list