Deleted Added
full compact
SemaChecking.cpp (280031) SemaChecking.cpp (283526)
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;
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;
300
301 case Builtin::BI__builtin_classify_type:
302 if (checkArgCount(*this, TheCall, 1)) return true;
303 TheCall->setType(Context.IntTy);
304 break;
305 case Builtin::BI__builtin_constant_p:
306 if (checkArgCount(*this, TheCall, 1)) return true;
307 TheCall->setType(Context.IntTy);

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

2362 if (Result.getSExtValue() < Low || Result.getSExtValue() > High)
2363 return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
2364 << Low << High << Arg->getSourceRange();
2365
2366 return false;
2367}
2368
2369/// SemaBuiltinLongjmp - Handle __builtin_longjmp(void *env[5], int val).
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).
2370/// This checks that val is a constant 1.
2374/// This checks that the target supports __builtin_longjmp and
2375/// that val is a constant 1.
2371bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {
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
2372 Expr *Arg = TheCall->getArg(1);
2373 llvm::APSInt Result;
2374
2375 // TODO: This is less than ideal. Overload this to take a value.
2376 if (SemaBuiltinConstantArg(TheCall, 1, Result))
2377 return true;
2378
2379 if (Result != 1)
2380 return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_invalid_val)
2381 << SourceRange(Arg->getLocStart(), Arg->getLocEnd());
2382
2383 return false;
2384}
2385
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
2386namespace {
2387enum StringLiteralCheckType {
2388 SLCT_NotALiteral,
2389 SLCT_UncheckedLiteral,
2390 SLCT_CheckedLiteral
2391};
2392}
2393

--- 6468 unchanged lines hidden ---
2405namespace {
2406enum StringLiteralCheckType {
2407 SLCT_NotALiteral,
2408 SLCT_UncheckedLiteral,
2409 SLCT_CheckedLiteral
2410};
2411}
2412

--- 6468 unchanged lines hidden ---