diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-28 06:07:14 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-28 06:07:14 +0000 |
commit | 53d0ea5f5bfa647ec23418bf3a3b7c183b51e4bd (patch) | |
tree | 588340921cc284ce356556588d0916c8f422d298 /lib/Sema/Sema.h | |
parent | 0d52da1812bfc70fd7a577966104c1c9d03143f6 (diff) |
Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.h')
-rw-r--r-- | lib/Sema/Sema.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 0dda082d7e..73468dc579 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -68,15 +68,8 @@ class Sema : public Action { Preprocessor &PP; ASTContext &Context; ASTConsumer &Consumer; - - /// CurFunctionDecl - If inside of a function body, this contains a pointer to - /// the function decl for the function being parsed. - FunctionDecl *CurFunctionDecl; - - /// CurMethodDecl - If inside of a method body, this contains a pointer to - /// the method decl for the method being parsed. - ObjCMethodDecl *CurMethodDecl; + /// CurContext - This is the current declaration context of parsing. DeclContext *CurContext; /// LabelMap - This is a mapping from label identifiers to the LabelStmt for @@ -267,6 +260,18 @@ private: /// Set the current declaration context until it gets popped. void PushDeclContext(DeclContext *DC); void PopDeclContext(); + + /// CurFunctionDecl - If inside of a function body, this returns a pointer to + /// the function decl for the function being parsed. + FunctionDecl *getCurFunctionDecl() { + return dyn_cast<FunctionDecl>(CurContext); + } + + /// CurMethodDecl - If inside of a method body, this returns a pointer to + /// the method decl for the method being parsed. + ObjCMethodDecl *getCurMethodDecl() { + return dyn_cast<ObjCMethodDecl>(CurContext); + } /// Add this decl to the scope shadowed decl chains. void PushOnScopeChains(NamedDecl *D, Scope *S); |