This is a follow-up to an IRC conversation with Richard last night; __assume
does not evaluate its argument, and so the argument should not contribute to
whether (__assume(e), constant) can be used where a constant is required.
llvm-svn: 213267
return true;
}
}
+
+ bool VisitCallExpr(const CallExpr *E) {
+ switch (E->getBuiltinCallee()) {
+ default:
+ return ExprEvaluatorBaseTy::VisitCallExpr(E);
+ case Builtin::BI__assume:
+ // The argument is not evaluated!
+ return true;
+ }
+ }
};
} // end anonymous namespace
int foo(int *a, int i) {
__assume(i != 4);
__assume(++i > 2); //expected-warning {{the argument to __assume has side effects that will be discarded}}
+
+ int test = sizeof(struct{char qq[(__assume(i != 5), 7)];});
+
return a[i];
}