[PATCH] D13126: New static analyzer checker for loss of sign/precision

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 05:49:17 PDT 2016


danielmarjamaki marked 3 inline comments as done.

================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:12
@@ +11,3 @@
+//
+// ConversionChecker generates a subset of the warnings that are reported by
+// Wconversion. It is designed to be an alternative to Wconversion.
----------------
Thanks! I have tried to do that.

================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:30
@@ +29,3 @@
+
+namespace {
+class ConversionChecker : public Checker<check::PreStmt<ImplicitCastExpr>> {
----------------
ok

================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:85
@@ +84,3 @@
+  if (!N)
+    return;
+
----------------
I renamed and changed these functions. Hope we all like it better now. The name is now "greaterEqualState" and it returns the state when the value is greater or equal. If there is no such state it returns nullptr.

As far as I see the diagnostics are showing the proper path now..

================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:148
@@ +147,3 @@
+  QualType SubType = Cast->IgnoreParenImpCasts()->getType();
+
+  if (!CastType->isIntegerType() || !SubType->isIntegerType())
----------------
sorry about that, I have fixed it


http://reviews.llvm.org/D13126





More information about the cfe-commits mailing list