[PATCH] D42745: [analyzer] Add support for __builtin_constant_p to BuiltinFunctionChecker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 13:21:05 PST 2018


NoQ added a comment.

Nice, thanks!



================
Comment at: lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp:126
+      SVB.getBasicValueFactory().getAPSIntType(CE->getType()).apply(Result);
+      V = SVB.makeIntVal(Result);
+    }
----------------
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fconstant_005fp
>  The function returns the integer 1 if the argument is known to be a compile-time constant
I don't think it returns the constant value to which the expression has evaluated.
Could you add a test in which the expression evaluates to a constant and this constant is 0?


Repository:
  rC Clang

https://reviews.llvm.org/D42745





More information about the cfe-commits mailing list