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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to