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 | 853fbea313b8be8cbfd2ac94e3e366300621aad6 (patch) | |
tree | d67b37cd1cea6d3af63c9108314fbf825003c35f /clang/lib/Sema/Sema.h | |
parent | 17013286755b05167ce896701769c23b392fe366 (diff) | |
download | bcm5719-llvm-853fbea313b8be8cbfd2ac94e3e366300621aad6.tar.gz bcm5719-llvm-853fbea313b8be8cbfd2ac94e3e366300621aad6.zip |
Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
llvm-svn: 52852
Diffstat (limited to 'clang/lib/Sema/Sema.h')
-rw-r--r-- | clang/lib/Sema/Sema.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 0dda082d7e3..73468dc579c 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/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); |