[PATCH] D105340: [analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 13:50:06 PST 2022


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

This looks great with the option flag. Landing this patch will enable more people to test the new mode and produce feedback on whether the constraint solver keeps working well enough in presence of the new symbols.



================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1004
+                                                  QualType CastTy) {
+  // We use seven conditions to recognize a simplification case.
+  // For the clarity let `CastTy` be `C`, SE->getType() - `T`, root type - `R`,
----------------
I really hope these are correct with respect to sign extension 🤞


================
Comment at: clang/test/Analysis/produce-symbolcast_x64.cpp:15
+void test_schar(schar x) {
+  clang_analyzer_dump(x); // expected-warning{{reg_$0<schar x>}}
+
----------------
There's `clang_analyzer_denote()`/`clang_analyzer_express()` which is slightly better because it avoids testing the specific dump format (so we could change it more easily if we want). No pressure though, if it's too much work to re-do then let's keep them as is.


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

https://reviews.llvm.org/D105340



More information about the cfe-commits mailing list