From 84ce606b9108b83e8f44985481f5fa26cfd4fc18 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 24 Jul 2012 17:59:41 +0000 Subject: 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. llvm-svn: 160681 --- clang/lib/Sema/SemaDecl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 52aa5b72d19..12444e55594 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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; -- cgit v1.2.3