[cfe-commits] r59829 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaExpr.cpp test/Sema/exprs.c
Chris Lattner
sabre at nondot.org
Fri Nov 21 10:27:44 PST 2008
Author: lattner
Date: Fri Nov 21 12:27:34 2008
New Revision: 59829
URL: http://llvm.org/viewvc/llvm-project?rev=59829&view=rev
Log:
print a type in a diagnostic.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/exprs.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=59829&r1=59828&r2=59829&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Fri Nov 21 12:27:34 2008
@@ -1250,7 +1250,7 @@
DIAG(err_block_decl_ref_not_modifiable_lvalue, ERROR,
"variable is not assignable (missing __block type specifier)")
DIAG(err_typecheck_call_not_function, ERROR,
- "called object is not a function or function pointer")
+ "called object type '%0' is not a function or function pointer")
DIAG(err_typecheck_call_too_few_args, ERROR,
"too few arguments to function")
DIAG(err_typecheck_block_too_few_args, ERROR,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=59829&r1=59828&r2=59829&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 21 12:27:34 2008
@@ -1347,7 +1347,7 @@
const PointerType *PT = Fn->getType()->getAsPointerType();
if (PT == 0)
return Diag(LParenLoc, diag::err_typecheck_call_not_function)
- << Fn->getSourceRange();
+ << Fn->getType().getAsString() << Fn->getSourceRange();
FuncT = PT->getPointeeType()->getAsFunctionType();
} else { // This is a block call.
FuncT = Fn->getType()->getAsBlockPointerType()->getPointeeType()->
@@ -1355,7 +1355,7 @@
}
if (FuncT == 0)
return Diag(LParenLoc, diag::err_typecheck_call_not_function)
- << Fn->getSourceRange();
+ << Fn->getType().getAsString() << Fn->getSourceRange();
// We know the result type of the call, set it.
TheCall->setType(FuncT->getResultType().getNonReferenceType());
Modified: cfe/trunk/test/Sema/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/exprs.c?rev=59829&r1=59828&r2=59829&view=diff
==============================================================================
--- cfe/trunk/test/Sema/exprs.c (original)
+++ cfe/trunk/test/Sema/exprs.c Fri Nov 21 12:27:34 2008
@@ -29,3 +29,7 @@
(float*)X = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}
}
+void test6() {
+ int X;
+ X(); // expected-error {{called object type 'int' is not a function or function pointer}}
+}
More information about the cfe-commits
mailing list