[PATCH] D35109: [Analyzer] SValBuilder Comparison Rearrangement

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 7 02:43:45 PDT 2017


NoQ added a comment.

Thanks, this looks great!

Because integer promotion rules are tricky, could we, for now, avoid dealing with the situation when left-hand side and right-hand side and the result (all three) are not all of the same type? Or maybe we'd like to support substraction of unsigned values into a signed value of the same size, but still avoid the rest of the cases. Because it'd take an overwhelming amount of testing to ensure that we get all the promotion cases correctly.



================
Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:583
+            newRhs = BasicVals.evalAPSInt(BO_Add, *lInt, *rInt);
+            reverse = (lop == BO_Add);
+          } else {
----------------
I'm afraid we may step into `BO_Mul` here, or something like that. Could you add a check somewhere that all the operations involved are either `BO_Add` or `BO_Sub`?


https://reviews.llvm.org/D35109





More information about the cfe-commits mailing list