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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49224 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 8197e46..d0cd999 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -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;
}
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 38a20c1..b1a2499 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -335,7 +335,7 @@
ContextDecl *ContextDecl::getParent() const {
if (ScopedDecl *SD = dyn_cast<ScopedDecl>(this))
- return SD->getContext();
+ return SD->getContextDecl();
else
return NULL;
}
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index 3a79b9e..e6b3f93 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -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) {