summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-09 00:58:37 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-09 00:58:37 +0000
commit2f67f37dafece55eb13d765e1e67f6175ebe520d (patch)
tree00edf7b6e630c699c0e7a859b5d12ecd5a0f3f6f /clang/lib/Sema
parent4455a9d3785673aee04808752bacf3687d618be3 (diff)
downloadbcm5719-llvm-2f67f37dafece55eb13d765e1e67f6175ebe520d.tar.gz
bcm5719-llvm-2f67f37dafece55eb13d765e1e67f6175ebe520d.zip
When in C++, invoke ASTConsumer::HandleTagDeclDefinition in Sema::ActOnFinishCXXClassDef,
at which point the C++ struct/class/union is fully parsed. llvm-svn: 54569
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp9
2 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3b4ad02dea5..a96195e525f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2142,7 +2142,10 @@ void Sema::ActOnFields(Scope* S,
// 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))
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 87efe2ba4b1..554e7426694 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -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::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
}
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);
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud