aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-07-24 17:59:41 +0000
committerHans Wennborg <hans@hanshq.net>2012-07-24 17:59:41 +0000
commit168c07b93510aabd2a19af323d1132fffe498ee4 (patch)
tree8ad4328ff2f5b6398b4d77022384ace64d81ddf4 /lib/Sema/SemaDecl.cpp
parentdb13f04dd0579874932bdb958647d0903f632dd4 (diff)
Tweak warning text for returning incomplete type from extern "C" functions.
A warning was added in r150128 for returning non-C compatible user-defined types from functions with C linkage. This makes the text more clear for the case when the type isn't decidedly non-C compatible, but incomplete. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 52aa5b72d1..12444e5559 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -6086,10 +6086,11 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
// compatible, and if it does, warn the user.
if (NewFD->isExternC()) {
QualType R = NewFD->getResultType();
- if (!R.isPODType(Context) &&
- !R->isVoidType())
- Diag( NewFD->getLocation(), diag::warn_return_value_udt )
- << NewFD << R;
+ if (R->isIncompleteType() && !R->isVoidType())
+ Diag(NewFD->getLocation(), diag::warn_return_value_udt_incomplete)
+ << NewFD << R;
+ else if (!R.isPODType(Context) && !R->isVoidType())
+ Diag(NewFD->getLocation(), diag::warn_return_value_udt) << NewFD << R;
}
}
return Redeclaration;