diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-28 06:44:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-28 06:44:59 +0000 |
commit | f05ca7df086aa2c176bbc32408fb3f9eaef82c05 (patch) | |
tree | 8dfeccb2e6e7590e2ddeaa933d0588fc71f57f8a | |
parent | 5721c68299edddd6d6dc32f6ea5441bcfa20dfd8 (diff) |
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
-rw-r--r-- | include/clang/AST/Decl.h | 20 |
1 files 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<NamespaceDecl>(getNextDeclarator()); - } - const NamespaceDecl *getNextNamespace() const { - return cast_or_null<NamespaceDecl>(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; |