[cfe-commits] r67926 - /cfe/trunk/include/clang/AST/Decl.h

Chris Lattner sabre at nondot.org
Fri Mar 27 23:44:59 PDT 2009


Author: lattner
Date: Sat Mar 28 01:44:59 2009
New Revision: 67926

URL: http://llvm.org/viewvc/llvm-project?rev=67926&view=rev
Log:
change NamespaceDecl to hold its 'NextNamespace' pointer itself
instead of in NextDeclarator.  This temporarily increases memory
usage, but simplifies and decouples things.

Modified:
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=67926&r1=67925&r2=67926&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sat Mar 28 01:44:59 2009
@@ -132,15 +132,15 @@
   // 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 @@
   
   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;





More information about the cfe-commits mailing list