Deleted Added
sdiff udiff text old ( 280031 ) new ( 283526 )
full compact
1//===--- SemaChecking.cpp - Extra Semantic Checking -----------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 283 unchanged lines hidden (view full) ---

292 case Builtin::BI__builtin_object_size:
293 if (SemaBuiltinConstantArgRange(TheCall, 1, 0, 3))
294 return ExprError();
295 break;
296 case Builtin::BI__builtin_longjmp:
297 if (SemaBuiltinLongjmp(TheCall))
298 return ExprError();
299 break;
300 case Builtin::BI__builtin_setjmp:
301 if (SemaBuiltinSetjmp(TheCall))
302 return ExprError();
303 break;
304
305 case Builtin::BI__builtin_classify_type:
306 if (checkArgCount(*this, TheCall, 1)) return true;
307 TheCall->setType(Context.IntTy);
308 break;
309 case Builtin::BI__builtin_constant_p:
310 if (checkArgCount(*this, TheCall, 1)) return true;
311 TheCall->setType(Context.IntTy);

--- 2054 unchanged lines hidden (view full) ---

2366 if (Result.getSExtValue() < Low || Result.getSExtValue() > High)
2367 return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
2368 << Low << High << Arg->getSourceRange();
2369
2370 return false;
2371}
2372
2373/// SemaBuiltinLongjmp - Handle __builtin_longjmp(void *env[5], int val).
2374/// This checks that the target supports __builtin_longjmp and
2375/// that val is a constant 1.
2376bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {
2377 if (!Context.getTargetInfo().hasSjLjLowering())
2378 return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_unsupported)
2379 << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd());
2380
2381 Expr *Arg = TheCall->getArg(1);
2382 llvm::APSInt Result;
2383
2384 // TODO: This is less than ideal. Overload this to take a value.
2385 if (SemaBuiltinConstantArg(TheCall, 1, Result))
2386 return true;
2387
2388 if (Result != 1)
2389 return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_invalid_val)
2390 << SourceRange(Arg->getLocStart(), Arg->getLocEnd());
2391
2392 return false;
2393}
2394
2395
2396/// SemaBuiltinSetjmp - Handle __builtin_setjmp(void *env[5]).
2397/// This checks that the target supports __builtin_setjmp.
2398bool Sema::SemaBuiltinSetjmp(CallExpr *TheCall) {
2399 if (!Context.getTargetInfo().hasSjLjLowering())
2400 return Diag(TheCall->getLocStart(), diag::err_builtin_setjmp_unsupported)
2401 << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd());
2402 return false;
2403}
2404
2405namespace {
2406enum StringLiteralCheckType {
2407 SLCT_NotALiteral,
2408 SLCT_UncheckedLiteral,
2409 SLCT_CheckedLiteral
2410};
2411}
2412

--- 6468 unchanged lines hidden ---