From: Argyrios Kyrtzidis Date: Wed, 28 Sep 2011 18:14:24 +0000 (+0000) Subject: Introduce non-const Decl::getParentFunctionOrMethod. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcc1e50ebcb441c6c610ccd539f57c57549bd66c;p=clang Introduce non-const Decl::getParentFunctionOrMethod. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140707 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 2a2f810044..7e093c8ceb 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -574,6 +574,10 @@ public: /// \brief If this decl is defined inside a function/method/block it returns /// the corresponding DeclContext, otherwise it returns null. const DeclContext *getParentFunctionOrMethod() const; + DeclContext *getParentFunctionOrMethod() { + return const_cast( + const_cast(this)->getParentFunctionOrMethod()); + } /// \brief Retrieves the "canonical" declaration of the given declaration. virtual Decl *getCanonicalDecl() { return this; }