[PATCH] D52730: [analysis] ConversionChecker: handle floating point

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 10:29:07 PDT 2018


Szelethus added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:175
+
+  if (RepresentsUntilExp >= sizeof(unsigned long long)*8) {
     return false;
----------------
How about `AC.getSizeType(AC.UnsignedLongLongTy))`?


================
Comment at: test/Analysis/conversion.c:192
+double floating_point(long long a, int b) {
+  if (a>1LL<<55) {
+    double r = a; // expected-warning {{Loss of precision}}
----------------
Need formatting.


================
Comment at: test/Analysis/conversion.c:195
+    return r;
+  } else if (b>1<<25) {
+    float f = b; // expected-warning {{Loss of precision}}
----------------
This too -- how about running clang-format on this file?


Repository:
  rC Clang

https://reviews.llvm.org/D52730





More information about the cfe-commits mailing list