[cfe-commits] r67919 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/AST/DeclSerialization.cpp

Chris Lattner sabre at nondot.org
Fri Mar 27 23:04:26 PDT 2009


Author: lattner
Date: Sat Mar 28 01:04:26 2009
New Revision: 67919

URL: http://llvm.org/viewvc/llvm-project?rev=67919&view=rev
Log:
rename NextDeclInScope to NextDeclInContext, since the pointer
points within contexts not scopes.

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/lib/AST/DeclBase.cpp
    cfe/trunk/lib/AST/DeclSerialization.cpp

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sat Mar 28 01:04:26 2009
@@ -86,13 +86,13 @@
   /// such as "int X, Y, *Z;" this indicates Decl for the next declarator.
   Decl *NextDeclarator;
   
-  /// NextDeclInScope - The next declaration within the same lexical
+  /// NextDeclInContext - The next declaration within the same lexical
   /// DeclContext. These pointers form the linked list that is
   /// traversed via DeclContext's decls_begin()/decls_end().
   /// FIXME: If NextDeclarator is non-NULL, will it always be the same
-  /// as NextDeclInScope? If so, we can use a
+  /// as NextDeclInContext? If so, we can use a
   /// PointerIntPair<Decl*, 1> to make Decl smaller.
-  Decl *NextDeclInScope;
+  Decl *NextDeclInContext;
 
   friend class DeclContext;
 
@@ -160,7 +160,7 @@
   friend class CXXClassMemberWrapper;
 
   Decl(Kind DK, DeclContext *DC, SourceLocation L) 
-    : NextDeclarator(0), NextDeclInScope(0), 
+    : NextDeclarator(0), NextDeclInContext(0), 
       DeclCtx(DC, 0), 
       Loc(L), DeclKind(DK), InvalidDecl(0),
       HasAttrs(false), Implicit(false), 
@@ -181,8 +181,8 @@
   Kind getKind() const { return DeclKind; }
   const char *getDeclKindName() const;
   
-  Decl *getNextDeclInScope() { return NextDeclInScope; }
-  const Decl *getNextDeclInScope() const { return NextDeclInScope; }
+  Decl *getNextDeclInContext() { return NextDeclInContext; }
+  const Decl *getNextDeclInContext() const { return NextDeclInContext; }
 
   DeclContext *getDeclContext() {
     if (isInSemaDC())
@@ -529,7 +529,7 @@
     pointer operator->() const { return Current; }
 
     decl_iterator& operator++() {
-      Current = Current->getNextDeclInScope();
+      Current = Current->getNextDeclInContext();
       return *this;
     }
 

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=67919&r1=67918&r2=67919&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Sat Mar 28 01:04:26 2009
@@ -282,15 +282,15 @@
   if (DeclContext *DC = dyn_cast<DeclContext>(this))
     DC->decls_begin()->Destroy(C);
 
-  // Observe the unrolled recursion.  By setting N->NextDeclInScope = 0x0
+  // Observe the unrolled recursion.  By setting N->NextDeclInContext = 0x0
   // within the loop, only the Destroy method for the first Decl
   // will deallocate all of the Decls in a chain.
   
-  Decl* N = NextDeclInScope;
+  Decl* N = getNextDeclInContext();
   
   while (N) {
-    Decl* Tmp = N->NextDeclInScope;
-    N->NextDeclInScope = 0;
+    Decl* Tmp = N->getNextDeclInContext();
+    N->NextDeclInContext = 0;
     N->Destroy(C);
     N = Tmp;
   }  
@@ -541,7 +541,7 @@
     if (DeclKind >= Decl::TagFirst && DeclKind <= Decl::TagLast) {
       // If this is a tag type that has a definition or is currently
       // being defined, that definition is our primary context.
-      if (const TagType *TagT = cast<TagDecl>(this)->TypeForDecl->getAsTagType())
+      if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAsTagType())
         if (TagT->isBeingDefined() || 
             (TagT->getDecl() && TagT->getDecl()->isDefinition()))
           return TagT->getDecl();
@@ -568,11 +568,11 @@
 void DeclContext::addDecl(Decl *D) {
   assert(D->getLexicalDeclContext() == this &&
          "Decl inserted into wrong lexical context");
-  assert(!D->NextDeclInScope && D != LastDecl && 
+  assert(!D->getNextDeclInContext() && D != LastDecl && 
          "Decl already inserted into a DeclContext");
 
   if (FirstDecl) {
-    LastDecl->NextDeclInScope = D;
+    LastDecl->NextDeclInContext = D;
     LastDecl = D;
   } else {
     FirstDecl = LastDecl = D;

Modified: cfe/trunk/lib/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=67919&r1=67918&r2=67919&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Sat Mar 28 01:04:26 2009
@@ -46,10 +46,10 @@
   if (getDeclContext() && 
       !getDeclContext()->isFunctionOrMethod()) {
     S.EmitBool(true);
-    S.EmitOwnedPtr(NextDeclInScope);
+    S.EmitOwnedPtr(NextDeclInContext);
   } else {
     S.EmitBool(false);
-    S.EmitPtr(NextDeclInScope);
+    S.EmitPtr(NextDeclInContext);
   }
 }
 
@@ -151,9 +151,9 @@
     DC->ReadOutRec(D, C);
   bool OwnsNext = D.ReadBool();
   if (OwnsNext)
-    Dcl->NextDeclInScope = D.ReadOwnedPtr<Decl>(C);
+    Dcl->NextDeclInContext = D.ReadOwnedPtr<Decl>(C);
   else 
-    D.ReadPtr(Dcl->NextDeclInScope);
+    D.ReadPtr(Dcl->NextDeclInContext);
   return Dcl;
 }
 





More information about the cfe-commits mailing list