[cfe-commits] r64759 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/Sema.h lib/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 17 00:12:06 PST 2009
Author: lattner
Date: Tue Feb 17 02:12:06 2009
New Revision: 64759
URL: http://llvm.org/viewvc/llvm-project?rev=64759&view=rev
Log:
emit:
t.c:4:9: error: invalid type 'short *' to __real operator
__tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)),
^
instead of:
t.c:4:9: error: invalid type 'short *' to __real or __imag operator
__tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)),
^
fixing a fixme. It would be even fancier to get the spelling of the token, but I
don't care *that* much :)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=64759&r1=64758&r2=64759&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Tue Feb 17 02:12:06 2009
@@ -813,9 +813,8 @@
"arithmetic on pointer to void type")
DIAG(err_typecheck_decl_incomplete_type, ERROR,
"variable has incomplete type %0")
-// FIXME: Use %select
DIAG(err_realimag_invalid_type, ERROR,
- "invalid type %0 to __real or __imag operator")
+ "invalid type %0 to %1 operator")
DIAG(err_typecheck_sclass_fscope, ERROR,
"illegal storage class on file-scoped variable")
DIAG(err_typecheck_sclass_func, ERROR,
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=64759&r1=64758&r2=64759&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Tue Feb 17 02:12:06 2009
@@ -1868,7 +1868,7 @@
bool isInc);
QualType CheckAddressOfOperand(Expr *op, SourceLocation OpLoc);
QualType CheckIndirectionOperand(Expr *op, SourceLocation OpLoc);
- QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc);
+ QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc, bool isReal);
/// type checking primary expressions.
QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=64759&r1=64758&r2=64759&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 17 02:12:06 2009
@@ -1180,7 +1180,7 @@
Range.getEnd()));
}
-QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc) {
+QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc, bool isReal) {
DefaultFunctionArrayConversion(V);
// These operators return the element type of a complex type.
@@ -1192,7 +1192,8 @@
return V->getType();
// Reject anything else.
- Diag(Loc, diag::err_realimag_invalid_type) << V->getType();
+ Diag(Loc, diag::err_realimag_invalid_type) << V->getType()
+ << (isReal ? "__real" : "__imag");
return QualType();
}
@@ -4058,7 +4059,7 @@
break;
case UnaryOperator::Real:
case UnaryOperator::Imag:
- resultType = CheckRealImagOperand(Input, OpLoc);
+ resultType = CheckRealImagOperand(Input, OpLoc, Opc == UnaryOperator::Real);
break;
case UnaryOperator::Extension:
resultType = Input->getType();
More information about the cfe-commits
mailing list