summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-02-03 00:32:51 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-02-03 00:32:51 +0000
commite165191990735c98cd49e5056e7fdffb9c06d8f9 (patch)
tree4c934dc0d0989b4d1e939a3d8e088e7d34c227b8 /clang/lib
parent249453fff0ff8037eb60c8d750216eaa362b7b8e (diff)
downloadbcm5719-llvm-e165191990735c98cd49e5056e7fdffb9c06d8f9.tar.gz
bcm5719-llvm-e165191990735c98cd49e5056e7fdffb9c06d8f9.zip
Simplify setting of DeclContext for @catch variable
(per Doug's comment). llvm-svn: 95169
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp1
-rw-r--r--clang/lib/Sema/SemaDecl.cpp10
2 files changed, 2 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index e837c765bff..ef65204e8c3 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1481,6 +1481,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
// Inform the actions module about the parameter declarator, so it
// gets added to the current scope.
+ // FIXME. Probably can build a VarDecl and avoid setting DeclContext.
FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
Actions.ActOnObjCCatchParam(FirstPart);
} else
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8c217f8e0d2..d203376f91b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3936,15 +3936,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
void Sema::ActOnObjCCatchParam(DeclPtrTy D) {
ParmVarDecl *Param = cast<ParmVarDecl>(D.getAs<Decl>());
-
- if (FunctionDecl *Function = dyn_cast<FunctionDecl>(CurContext))
- Param->setDeclContext(Function);
- else if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext))
- Param->setDeclContext(MD);
- else if (BlockDecl *BD = dyn_cast<BlockDecl>(CurContext))
- Param->setDeclContext(BD);
- // FIXME. Other contexts?
-
+ Param->setDeclContext(CurContext);
}
void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
OpenPOWER on IntegriCloud