This patch aims to fix a bug encountered by compiling code with C++14.
Specifically, when evaluating p in __builtin_object_size(p, n), we start speculatively evaluating. Currently, clang pretends that side-effects have always occurred when we start speculatively evaluating. This prevents us from reading any locals in C++14. So, the following code compiles fine in C++11 mode, but fails to compile with C++14:
void foo(char *p) __attribute__((enable_if(__builtin_object_size(p, 0) != -1, ""))); void runFoo() { char buf[5]; foo(buf); }
This patch makes ExprConstant note when we've actually failed (read: may have an unmodeled side-effect), and makes us act as conservatively before if a failure happened. If a failure hasn't happened, we can be more aggressive.