Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.

llvm-svn: 108505
This commit is contained in:
Chandler Carruth 2010-07-16 04:32:28 +00:00
parent 5530131bb7
commit 9339605c35
4 changed files with 10 additions and 8 deletions

View File

@ -72,6 +72,7 @@ def NonNull : DiagGroup<"nonnull">;
def : DiagGroup<"nonportable-cfstrings">;
def : DiagGroup<"non-virtual-dtor">;
def : DiagGroup<"old-style-definition">;
def OutOfLineDeclaration : DiagGroup<"out-of-line-declaration">;
def : DiagGroup<"overflow">;
def : DiagGroup<"overloaded-virtual">;
def : DiagGroup<"packed">;

View File

@ -2048,8 +2048,9 @@ def err_qualified_typedef_declarator : Error<
"typedef declarator cannot be qualified">;
def err_qualified_param_declarator : Error<
"parameter declarator cannot be qualified">;
def err_out_of_line_declaration : Error<
"out-of-line declaration of a member must be a definition">;
def ext_out_of_line_declaration : ExtWarn<
"out-of-line declaration of a member must be a definition">,
InGroup<OutOfLineDeclaration>;
def note_member_def_close_match : Note<"member declaration nearly matches">;
def err_typecheck_ivar_variable_size : Error<
"instance variables must have a constant size">;

View File

@ -3479,14 +3479,14 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// definition (C++ [dcl.meaning]p1).
// Note that this is not the case for explicit specializations of
// function templates or member functions of class templates, per
// C++ [temp.expl.spec]p2.
// C++ [temp.expl.spec]p2. We also allow these declarations as an extension
// for compatibility with old SWIG code which likes to generate them.
if (!IsFunctionDefinition && !isFriend &&
!isFunctionTemplateSpecialization && !isExplicitSpecialization) {
Diag(NewFD->getLocation(), diag::err_out_of_line_declaration)
Diag(NewFD->getLocation(), diag::ext_out_of_line_declaration)
<< D.getCXXScopeSpec().getRange();
NewFD->setInvalidDecl();
} else if (!Redeclaration &&
!(isFriend && CurContext->isDependentContext())) {
}
if (!Redeclaration && !(isFriend && CurContext->isDependentContext())) {
// The user tried to provide an out-of-line definition for a
// function that is a member of a class or namespace, but there
// was no such member function declared (C++ [class.mfct]p2,

View File

@ -102,7 +102,7 @@ void f6(int A2::RC::x); // expected-error{{parameter declarator cannot be qualif
int A2::RC::x; // expected-error{{non-static data member defined out-of-line}}
void A2::CC::NC::m(); // expected-error{{out-of-line declaration of a member must be a definition}}
void A2::CC::NC::m(); // expected-warning{{out-of-line declaration of a member must be a definition}}
namespace E {