[cfe-commits] r54607 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaChecking.cpp
Chris Lattner
sabre at nondot.org
Sat Aug 9 19:05:13 PDT 2008
Author: lattner
Date: Sat Aug 9 21:05:13 2008
New Revision: 54607
URL: http://llvm.org/viewvc/llvm-project?rev=54607&view=rev
Log:
tighten up some code and some wording on diagnostics.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=54607&r1=54606&r2=54607&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sat Aug 9 21:05:13 2008
@@ -1139,13 +1139,13 @@
DIAG(err_shufflevector_incompatible_vector, ERROR,
"first two arguments to __builtin_shufflevector must have the same type")
DIAG(err_shufflevector_nonconstant_argument, ERROR,
- "indexes for __builtin_shufflevector must be constant integers")
+ "index for __builtin_shufflevector must be a constant integer")
DIAG(err_shufflevector_argument_too_large, ERROR,
- "indexes for __builtin_shufflevector must be less than the total number"
+ "index for __builtin_shufflevector must be less than the total number"
" of vector elements")
DIAG(err_stack_const_level, ERROR,
- "the level argument for a stack address builtin must be constant")
+ "level argument for a stack address builtin must be constant")
DIAG(err_prefetch_invalid_argument, ERROR,
"argument to __builtin_prefetch must be a constant integer")
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=54607&r1=54606&r2=54607&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Sat Aug 9 21:05:13 2008
@@ -224,9 +224,9 @@
// The signature for these builtins is exact; the only thing we need
// to check is that the argument is a constant.
SourceLocation Loc;
- if (!TheCall->getArg(0)->isIntegerConstantExpr(Context, &Loc)) {
+ if (!TheCall->getArg(0)->isIntegerConstantExpr(Context, &Loc))
return Diag(Loc, diag::err_stack_const_level, TheCall->getSourceRange());
- }
+
return false;
}
@@ -258,43 +258,35 @@
unsigned numElements = FAType->getAsVectorType()->getNumElements();
if (TheCall->getNumArgs() != numElements+2) {
if (TheCall->getNumArgs() < numElements+2)
- Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args,
- TheCall->getSourceRange());
- else
- Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_many_args,
- TheCall->getSourceRange());
- return true;
+ return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args,
+ TheCall->getSourceRange());
+ return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_many_args,
+ TheCall->getSourceRange());
}
for (unsigned i = 2; i < TheCall->getNumArgs(); i++) {
llvm::APSInt Result(32);
- if (!TheCall->getArg(i)->isIntegerConstantExpr(Result, Context)) {
- Diag(TheCall->getLocStart(),
- diag::err_shufflevector_nonconstant_argument,
- TheCall->getArg(i)->getSourceRange());
- return true;
- }
- if (Result.getActiveBits() > 64 || Result.getZExtValue() >= numElements*2) {
- Diag(TheCall->getLocStart(),
- diag::err_shufflevector_argument_too_large,
- TheCall->getArg(i)->getSourceRange());
- return true;
- }
+ if (!TheCall->getArg(i)->isIntegerConstantExpr(Result, Context))
+ return Diag(TheCall->getLocStart(),
+ diag::err_shufflevector_nonconstant_argument,
+ TheCall->getArg(i)->getSourceRange());
+
+ if (Result.getActiveBits() > 64 || Result.getZExtValue() >= numElements*2)
+ return Diag(TheCall->getLocStart(),
+ diag::err_shufflevector_argument_too_large,
+ TheCall->getArg(i)->getSourceRange());
}
llvm::SmallVector<Expr*, 32> exprs;
- for (unsigned i = 0; i < TheCall->getNumArgs(); i++) {
+ for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i++) {
exprs.push_back(TheCall->getArg(i));
TheCall->setArg(i, 0);
}
- ShuffleVectorExpr* E = new ShuffleVectorExpr(
- exprs.begin(), numElements+2, FAType,
- TheCall->getCallee()->getLocStart(),
- TheCall->getRParenLoc());
-
- return E;
+ return new ShuffleVectorExpr(exprs.begin(), numElements+2, FAType,
+ TheCall->getCallee()->getLocStart(),
+ TheCall->getRParenLoc());
}
/// SemaBuiltinPrefetch - Handle __builtin_prefetch.
More information about the cfe-commits
mailing list