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 | 17c0eac8794f9710ae568a46990f57901bbc5fff (patch) | |
| tree | fb5f76a1838c17127b9a0eac84e582a5bef0347f /clang/lib | |
| parent | 636d6ed0c168366725bf7069d3e4d6957896acd4 (diff) | |
| download | bcm5719-llvm-17c0eac8794f9710ae568a46990f57901bbc5fff.tar.gz bcm5719-llvm-17c0eac8794f9710ae568a46990f57901bbc5fff.zip | |
fix PR7885, rejecting invalid uses of __builtin_constant_p.
llvm-svn: 116317
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index f03e1f93103..1a07a86f80c 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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: |

