summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-11 18:46:21 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-11 18:46:21 +0000
commitbb91767b824cf1b78cb551c308ca51f8da4e4377 (patch)
tree94f76f1e3fa924f1a0aaad8497412cbd7fdf0e3b /clang/lib
parent0ef736fef25b2bb65c5ccb6ab920f52aeed84c56 (diff)
downloadbcm5719-llvm-bb91767b824cf1b78cb551c308ca51f8da4e4377.tar.gz
bcm5719-llvm-bb91767b824cf1b78cb551c308ca51f8da4e4377.zip
Tighten up the "cannot return array or function type" diagnostic to
say either "array type" or "function type", whichever it is. No reason to make the user guess. llvm-svn: 93164
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaType.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 499160d11f4..2bddf9ecd60 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -743,7 +743,8 @@ QualType Sema::BuildFunctionType(QualType T,
bool Variadic, unsigned Quals,
SourceLocation Loc, DeclarationName Entity) {
if (T->isArrayType() || T->isFunctionType()) {
- Diag(Loc, diag::err_func_returning_array_function) << T;
+ Diag(Loc, diag::err_func_returning_array_function)
+ << T->isFunctionType() << T;
return QualType();
}
@@ -1045,9 +1046,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun;
// C99 6.7.5.3p1: The return type may not be a function or array type.
+ // For conversion functions, we'll diagnose this particular error later.
if ((T->isArrayType() || T->isFunctionType()) &&
(D.getName().getKind() != UnqualifiedId::IK_ConversionFunctionId)) {
- Diag(DeclType.Loc, diag::err_func_returning_array_function) << T;
+ Diag(DeclType.Loc, diag::err_func_returning_array_function)
+ << T->isFunctionType() << T;
T = Context.IntTy;
D.setInvalidType(true);
}
OpenPOWER on IntegriCloud