// Okay, we successfully defined 'Record'.
if (Record) {
Record->defineBody(&RecFields[0], RecFields.size());
- Consumer.HandleTagDeclDefinition(Record);
+ // If this is a C++ record, HandleTagDeclDefinition will be invoked in
+ // Sema::ActOnFinishCXXClassDef.
+ if (!isa<CXXRecordDecl>(Record))
+ Consumer.HandleTagDeclDefinition(Record);
} else {
ObjCIvarDecl **ClsFields = reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]);
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(EnclosingDecl))
#include "Sema.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
}
void Sema::ActOnFinishCXXClassDef(DeclTy *D) {
- Decl *Dcl = static_cast<Decl *>(D);
- assert(isa<CXXRecordDecl>(Dcl) &&
- "Invalid parameter, expected CXXRecordDecl");
+ CXXRecordDecl *Rec = cast<CXXRecordDecl>(static_cast<Decl *>(D));
FieldCollector->FinishClass();
PopDeclContext();
+
+ // Everything, including inline method definitions, have been parsed.
+ // Let the consumer know of the new TagDecl definition.
+ Consumer.HandleTagDeclDefinition(Rec);
}
//===----------------------------------------------------------------------===//