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

Steve Naroff snaroff at apple.com
Fri Apr 4 11:15:49 PDT 2008


Author: snaroff
Date: Fri Apr  4 13:15:49 2008
New Revision: 49224

URL: http://llvm.org/viewvc/llvm-project?rev=49224&view=rev
Log:
Rename ScopedDecl::getContext() -> getContextDecl(). Two motivations:

#1: To be consistent with FieldDecl::getContextDecl(), which serves the same purpose.
#2: From my perspective, getContext() is too general (and used by several other classes for different purposes).

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Apr  4 13:15:49 2008
@@ -66,7 +66,7 @@
     : NamedDecl(DK, L, Id), NextDeclarator(PrevDecl), Next(0), CtxDecl(CD) {}
   
 public:
-  ContextDecl *getContext() const { return CtxDecl; }
+  ContextDecl *getContextDecl() const { return CtxDecl; }
 
   ScopedDecl *getNext() const { return Next; }
   void setNext(ScopedDecl *N) { Next = N; }
@@ -83,8 +83,8 @@
   // roughly global variables and functions, but also handles enums (which could
   // be defined inside or outside a function etc).
   bool isDefinedOutsideFunctionOrMethod() const {
-    if (getContext())
-      return !getContext()->isFunctionOrMethod();
+    if (getContextDecl())
+      return !getContextDecl()->isFunctionOrMethod();
     else
       return true;
   }

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

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Apr  4 13:15:49 2008
@@ -335,7 +335,7 @@
 
 ContextDecl *ContextDecl::getParent() const {
   if (ScopedDecl *SD = dyn_cast<ScopedDecl>(this))
-    return SD->getContext();
+    return SD->getContextDecl();
   else
     return NULL;
 }

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

==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Fri Apr  4 13:15:49 2008
@@ -106,7 +106,7 @@
 void ScopedDecl::EmitInRec(Serializer& S) const {
   NamedDecl::EmitInRec(S);
   S.EmitPtr(getNext());                     // From ScopedDecl.  
-  S.EmitPtr(cast_or_null<Decl>(getContext()));  // From ScopedDecl.
+  S.EmitPtr(cast_or_null<Decl>(getContextDecl()));  // From ScopedDecl.
 }
 
 void ScopedDecl::ReadInRec(Deserializer& D) {





More information about the cfe-commits mailing list