[cfe-commits] r54569 - in /cfe/trunk/lib/Sema: SemaDecl.cpp SemaDeclCXX.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Fri Aug 8 17:58:37 PDT 2008
Author: akirtzidis
Date: Fri Aug 8 19:58:37 2008
New Revision: 54569
URL: http://llvm.org/viewvc/llvm-project?rev=54569&view=rev
Log:
When in C++, invoke ASTConsumer::HandleTagDeclDefinition in Sema::ActOnFinishCXXClassDef,
at which point the C++ struct/class/union is fully parsed.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=54569&r1=54568&r2=54569&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 8 19:58:37 2008
@@ -2142,7 +2142,10 @@
// 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))
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=54569&r1=54568&r2=54569&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 8 19:58:37 2008
@@ -13,6 +13,7 @@
#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"
@@ -469,11 +470,13 @@
}
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);
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list