]> granicus.if.org Git - clang/commitdiff
Introduce non-const Decl::getParentFunctionOrMethod.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 28 Sep 2011 18:14:24 +0000 (18:14 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 28 Sep 2011 18:14:24 +0000 (18:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140707 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h

index 2a2f8100442527b9221552bdf5e6fd7f8e37c11b..7e093c8ceb909370b7aed28f58328a6f23a2aab6 100644 (file)
@@ -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<DeclContext*>(
+                    const_cast<const Decl*>(this)->getParentFunctionOrMethod());
+  }
 
   /// \brief Retrieves the "canonical" declaration of the given declaration.
   virtual Decl *getCanonicalDecl() { return this; }