From c7d38433cd86f49bd50bc6fb88faf4d4a0ae6cbb Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Fri, 4 Apr 2008 18:15:49 +0000 Subject: [PATCH] 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). llvm-svn: 49224 --- clang/include/clang/AST/Decl.h | 6 +++--- clang/lib/AST/Decl.cpp | 2 +- clang/lib/AST/DeclSerialization.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 8197e46c8740..d0cd999f9a9a 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -66,7 +66,7 @@ protected: : 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 @@ public: // 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; } diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 38a20c1c015e..b1a2499949c0 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -335,7 +335,7 @@ const Attr *Decl::getAttrs() const { ContextDecl *ContextDecl::getParent() const { if (ScopedDecl *SD = dyn_cast(this)) - return SD->getContext(); + return SD->getContextDecl(); else return NULL; } diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp index 3a79b9e0e292..e6b3f93096ce 100644 --- a/clang/lib/AST/DeclSerialization.cpp +++ b/clang/lib/AST/DeclSerialization.cpp @@ -106,7 +106,7 @@ void NamedDecl::ReadInRec(Deserializer& D) { void ScopedDecl::EmitInRec(Serializer& S) const { NamedDecl::EmitInRec(S); S.EmitPtr(getNext()); // From ScopedDecl. - S.EmitPtr(cast_or_null(getContext())); // From ScopedDecl. + S.EmitPtr(cast_or_null(getContextDecl())); // From ScopedDecl. } void ScopedDecl::ReadInRec(Deserializer& D) {