зеркало из https://github.com/microsoft/clang-1.git
Make the non-const DeclContext::getParent call the const version, instead of the other way around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
dbd32c20c5
Коммит
20bc676228
|
@ -294,9 +294,10 @@ protected:
|
|||
public:
|
||||
/// getParent - Returns the containing DeclContext if this is a ScopedDecl,
|
||||
/// else returns NULL.
|
||||
DeclContext *getParent();
|
||||
const DeclContext *getParent() const {
|
||||
return const_cast<DeclContext*>(this)->getParent();
|
||||
const DeclContext *getParent() const;
|
||||
DeclContext *getParent() {
|
||||
return const_cast<DeclContext*>(
|
||||
const_cast<const DeclContext*>(this)->getParent());
|
||||
}
|
||||
|
||||
bool isFunctionOrMethod() const {
|
||||
|
|
|
@ -353,10 +353,10 @@ DeclContext *Decl::castToDeclContext(const Decl *D) {
|
|||
// DeclContext Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
DeclContext *DeclContext::getParent() {
|
||||
if (ScopedDecl *SD = dyn_cast<ScopedDecl>(this))
|
||||
const DeclContext *DeclContext::getParent() const {
|
||||
if (const ScopedDecl *SD = dyn_cast<ScopedDecl>(this))
|
||||
return SD->getDeclContext();
|
||||
else if (BlockDecl *BD = dyn_cast<BlockDecl>(this))
|
||||
else if (const BlockDecl *BD = dyn_cast<BlockDecl>(this))
|
||||
return BD->getParentContext();
|
||||
else
|
||||
return NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче