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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 13:00:54 PST 2018


NoQ added a comment.

Oh, i see what you did here. I thought you're evaluating the argument, but you're evaluating the whole builtin function call. In this case you don't need the else-branch: `EvaluateAsInt` will always succeed. Moreover, you can merge your code with the `BI__builtin_object_size` case, which is also fully evaluated at compile-time.

Actually, maybe we should use that approach to evaluate more builtin functions, and all C++ //constexpr// function calls as well, in the engine or in a checker. It would be a nice thing to tackle eventually.


https://reviews.llvm.org/D42745





More information about the cfe-commits mailing list