diff options
author | Chris Lattner <sabre@nondot.org> | 2010-10-12 17:47:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-10-12 17:47:42 +0000 |
commit | 75c29a012793292ff4578015a9113bf086156d7f (patch) | |
tree | 9a5a41c08bb4464ceaeea974088815adfcd8ff0c /lib/Sema/SemaChecking.cpp | |
parent | 141ecfeeb54948159facce6aeb586e2f6c406f78 (diff) |
fix PR7885, rejecting invalid uses of __builtin_constant_p.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index f03e1f9310..1a07a86f80 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -198,6 +198,16 @@ Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { if (SemaBuiltinLongjmp(TheCall)) return ExprError(); break; + case Builtin::BI__builtin_constant_p: + if (TheCall->getNumArgs() == 0) + return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) + << 0 /*function call*/ << 1 << 0 << TheCall->getSourceRange(); + if (TheCall->getNumArgs() > 1) + return Diag(TheCall->getArg(1)->getLocStart(), + diag::err_typecheck_call_too_many_args) + << 0 /*function call*/ << 1 << TheCall->getNumArgs() + << TheCall->getArg(1)->getSourceRange(); + break; case Builtin::BI__sync_fetch_and_add: case Builtin::BI__sync_fetch_and_sub: case Builtin::BI__sync_fetch_and_or: |