diff options
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclBase.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index bf7efe8043d..a3713d5f3dc 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -438,6 +438,10 @@ public: return getBody(Definition); } + virtual Stmt* getCodeBody() const { + return getBody(); + } + /// isThisDeclarationADefinition - Returns whether this specific /// declaration of the function is also a definition. This does not /// determine whether the function has been defined (e.g., in a diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 55c2e61ff09..69db09c11be 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -195,6 +195,12 @@ public: return IdentifierNamespace(IDNS_Tag | IDNS_Ordinary); } } + + // getCodeBody - If this Decl represents a declaration for a body of code, + // such as a function or method definition, this method returns the top-level + // Stmt* of that body. Otherwise this method returns null. + virtual Stmt* getCodeBody() const { return 0; } + // global temp stats (until we have a per-module visitor) static void addDeclKind(Kind k); static bool CollectingStats(bool Enable = false); diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 093a5cf1a20..ed09eacfd9f 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -185,9 +185,11 @@ public: ImplementationControl getImplementationControl() const { return ImplementationControl(DeclImplementation); } - Stmt *getBody() { return Body; } - const Stmt *getBody() const { return Body; } + + Stmt *getBody() const { return Body; } void setBody(Stmt *B) { Body = B; } + + virtual Stmt* getCodeBody() const { return getBody(); } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return D->getKind() == ObjCMethod; } |

