[PATCH] D110625: [analyzer] canonicalize special case of structure/pointer deref
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 29 01:12:11 PDT 2021
steakhal added a comment.
nits
================
Comment at: clang/test/Analysis/ptr-arith.c:336
+ int v;
+ char y;
+};
----------------
It's probably unnecessary.
================
Comment at: clang/test/Analysis/ptr-arith.c:339
+
+void clang_analyzer_dump(int);
+
----------------
I would probably put this at the top of the file.
================
Comment at: clang/test/Analysis/ptr-arith.c:344
+ struct s ss = *ps;
+ clang_analyzer_dump((*ps).v); // expected-warning{{reg_$3<int SymRegion{reg_$0<struct s * ps>}.v>}}
+ clang_analyzer_dump(ps[0].v); // expected-warning{{reg_$3<int SymRegion{reg_$0<struct s * ps>}.v>}}
----------------
You should not hardcode the internal counter in the tests.
You can use regexp matching to workaround the issue. Here is an example:
`// expected-warning-re at -2 {{reg_${{[[:digit:]]+}}<int v>}}`
`@-2` denotes that we expect a warning two lines above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110625/new/
https://reviews.llvm.org/D110625
More information about the cfe-commits
mailing list