From f05ca7df086aa2c176bbc32408fb3f9eaef82c05 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 28 Mar 2009 06:44:59 +0000 Subject: [PATCH] change NamespaceDecl to hold its 'NextNamespace' pointer itself instead of in NextDeclarator. This temporarily increases memory usage, but simplifies and decouples things. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67926 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index f811ffa75a..69bb13a520 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -132,15 +132,15 @@ class NamespaceDecl : public NamedDecl, public DeclContext { // namespace A { int y; } // // there will be one NamespaceDecl for each declaration. - // NextDeclarator points to the next extended declaration. + // NextNamespace points to the next extended declaration. // OrigNamespace points to the original namespace declaration. // OrigNamespace of the first namespace decl points to itself. - - NamespaceDecl *OrigNamespace; - + NamespaceDecl *OrigNamespace, *NextNamespace; + NamespaceDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id) : NamedDecl(Namespace, DC, L, Id), DeclContext(Namespace) { - OrigNamespace = this; + OrigNamespace = this; + NextNamespace = 0; } public: static NamespaceDecl *Create(ASTContext &C, DeclContext *DC, @@ -148,13 +148,9 @@ public: virtual void Destroy(ASTContext& C); - NamespaceDecl *getNextNamespace() { - return cast_or_null(getNextDeclarator()); - } - const NamespaceDecl *getNextNamespace() const { - return cast_or_null(getNextDeclarator()); - } - void setNextNamespace(NamespaceDecl *ND) { setNextDeclarator(ND); } + NamespaceDecl *getNextNamespace() { return NextNamespace; } + const NamespaceDecl *getNextNamespace() const { return NextNamespace; } + void setNextNamespace(NamespaceDecl *ND) { NextNamespace = ND; } NamespaceDecl *getOriginalNamespace() const { return OrigNamespace; -- 2.40.0