diff options
author | Steve Naroff <snaroff@apple.com> | 2007-11-29 23:05:20 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-11-29 23:05:20 +0000 |
commit | 89307ffaf8acf4d6fdffd72b607ca4fbcfdffc9d (patch) | |
tree | bbf0f3ba5d789a183976c58fc486375e4d480bba /Sema/SemaDecl.cpp | |
parent | 2ff3e691ecc63a5d82d4023b46b5b47ce14ace53 (diff) |
Yesterday, I simplified how we stream top-level decls.
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).
TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaDecl.cpp')
-rw-r--r-- | Sema/SemaDecl.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 8d5c69915d..71f2f19226 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -191,9 +191,6 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, } else { II->setFETokenInfo(New); } - // Make sure clients iterating over decls see this. - AddTopLevelDecl(New); - return New; } @@ -676,10 +673,6 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { II->setFETokenInfo(New); S->AddDecl(New); } - - if (S->getParent() == 0) - AddTopLevelDecl(New); - // If any semantic error occurred, mark the decl as invalid. if (D.getInvalidType() || InvalidDecl) New->setInvalidDecl(); @@ -975,7 +968,6 @@ void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { NewFD->setNext(II->getFETokenInfo<ScopedDecl>()); II->setFETokenInfo(NewFD); GlobalScope->AddDecl(NewFD); - AddTopLevelDecl(NewFD); // Allow all of Sema to see that we are entering a method definition. CurMethodDecl = MDecl; @@ -1685,12 +1677,6 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK, break; } - // For top-level tag definitions, make sure we chain the the tag decl to - // the vardecl. This enables the AST streamer to see both X and D in the - // following example: struct X { int A; } D; - if (S->getParent() == 0) - AddTopLevelDecl(New); - // If this has an identifier, add it to the scope stack. if (Name) { // The scope passed in may not be a decl scope. Zip up the scope tree until @@ -2464,14 +2450,6 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX, Enum->defineElements(EltList, BestType); } -void Sema::AddTopLevelDecl(Decl *current) { - if (!current) return; - - // If this is a top-level decl that is chained to some other (e.g. int A,B,C;) - // remember this in the TopLevelDeclList list. - TopLevelDeclList.push_back((Decl*)current); -} - void Sema::HandleDeclAttribute(Decl *New, AttributeList *rawAttr) { if (!strcmp(rawAttr->getAttributeName()->getName(), "vector_size") || !strcmp(rawAttr->getAttributeName()->getName(), "__vector_size__")) { |