[cfe-commits] r170915 - /cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h

Jordan Rose jordan_rose at apple.com
Fri Dec 21 10:26:48 PST 2012


Author: jrose
Date: Fri Dec 21 12:26:48 2012
New Revision: 170915

URL: http://llvm.org/viewvc/llvm-project?rev=170915&view=rev
Log:
[analyzer] Don't perform an expensive assertion in release builds.

Unfortunately, we don't seem to have a standard way to do this. I'm using
the __OPTIMIZE__ GNU extension that Clang also defines, but that doesn't
help MSVC. I suppose we could remove the check entirely, but it's useful
for developing new constraint managers.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h?rev=170915&r1=170914&r2=170915&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h Fri Dec 21 12:26:48 2012
@@ -78,9 +78,13 @@
     // If StTrue is infeasible, asserting the falseness of Cond is unnecessary
     // because the existing constraints already establish this.
     if (!StTrue) {
-      // FIXME: This is fairly expensive and should be disabled even in
-      // Release+Asserts builds.
+#ifndef __OPTIMIZE__
+      // This check is expensive and should be disabled even in Release+Asserts
+      // builds.
+      // FIXME: __OPTIMIZE__ is a GNU extension that Clang implements but MSVC
+      // does not. Is there a good equivalent there?
       assert(assume(State, Cond, false) && "System is over constrained.");
+#endif
       return ProgramStatePair((ProgramStateRef)NULL, State);
     }
 





More information about the cfe-commits mailing list