aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 06:07:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 06:07:14 +0000
commit53d0ea5f5bfa647ec23418bf3a3b7c183b51e4bd (patch)
tree588340921cc284ce356556588d0916c8f422d298 /lib/Sema/SemaDecl.cpp
parent0d52da1812bfc70fd7a577966104c1c9d03143f6 (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/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 0b048b0a0a..df75109e56 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1463,7 +1463,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
}
Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
- assert(CurFunctionDecl == 0 && "Function parsing confused");
+ assert(getCurFunctionDecl() == 0 && "Function parsing confused");
assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
"Not a function declarator!");
DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
@@ -1512,7 +1512,6 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
}
Decl *decl = static_cast<Decl*>(ActOnDeclarator(GlobalScope, D, 0));
FunctionDecl *FD = cast<FunctionDecl>(decl);
- CurFunctionDecl = FD;
PushDeclContext(FD);
// Check the validity of our function parameters
@@ -1533,11 +1532,9 @@ Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtTy *Body) {
Decl *dcl = static_cast<Decl *>(D);
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(dcl)) {
FD->setBody((Stmt*)Body);
- assert(FD == CurFunctionDecl && "Function parsing confused");
- CurFunctionDecl = 0;
+ assert(FD == getCurFunctionDecl() && "Function parsing confused");
} else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(dcl)) {
MD->setBody((Stmt*)Body);
- CurMethodDecl = 0;
}
PopDeclContext();
// Verify and clean out per-function state.