From 853fbea313b8be8cbfd2ac94e3e366300621aad6 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 28 Jun 2008 06:07:14 +0000 Subject: Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext. llvm-svn: 52852 --- clang/lib/Sema/SemaDecl.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 0b048b0a0af..df75109e562 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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(ActOnDeclarator(GlobalScope, D, 0)); FunctionDecl *FD = cast(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(D); if (FunctionDecl *FD = dyn_cast(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(dcl)) { MD->setBody((Stmt*)Body); - CurMethodDecl = 0; } PopDeclContext(); // Verify and clean out per-function state. -- cgit v1.2.3