diff options
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
| -rw-r--r-- | lib/Sema/SemaChecking.cpp | 21 | 
1 files changed, 20 insertions, 1 deletions
| diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index fdc136ccbd23..8c3efdee9036 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -297,6 +297,10 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,      if (SemaBuiltinLongjmp(TheCall))        return ExprError();      break; +  case Builtin::BI__builtin_setjmp: +    if (SemaBuiltinSetjmp(TheCall)) +      return ExprError(); +    break;    case Builtin::BI__builtin_classify_type:      if (checkArgCount(*this, TheCall, 1)) return true; @@ -2367,8 +2371,13 @@ bool Sema::SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,  }  /// SemaBuiltinLongjmp - Handle __builtin_longjmp(void *env[5], int val). -/// This checks that val is a constant 1. +/// This checks that the target supports __builtin_longjmp and +/// that val is a constant 1.  bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) { +  if (!Context.getTargetInfo().hasSjLjLowering()) +    return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_unsupported) +             << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd()); +    Expr *Arg = TheCall->getArg(1);    llvm::APSInt Result; @@ -2383,6 +2392,16 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {    return false;  } + +/// SemaBuiltinSetjmp - Handle __builtin_setjmp(void *env[5]). +/// This checks that the target supports __builtin_setjmp. +bool Sema::SemaBuiltinSetjmp(CallExpr *TheCall) { +  if (!Context.getTargetInfo().hasSjLjLowering()) +    return Diag(TheCall->getLocStart(), diag::err_builtin_setjmp_unsupported) +             << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd()); +  return false; +} +  namespace {  enum StringLiteralCheckType {    SLCT_NotALiteral, | 
