aboutsummaryrefslogtreecommitdiff
path: root/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-12-04 19:20:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-12-04 19:20:11 +0000
commitb107ce82d425939ce32fc3c02faf7c2364abc1a3 (patch)
treee08e45be44267da083b07b2f14d948befee0c039 /Sema/SemaChecking.cpp
parentb6427f821de8cce1566fb6e755143ea0918d5543 (diff)
Simplified setting up Method's scope before generating AST for its nody.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaChecking.cpp')
-rw-r--r--Sema/SemaChecking.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp
index 81a18c9645..b83e5120a1 100644
--- a/Sema/SemaChecking.cpp
+++ b/Sema/SemaChecking.cpp
@@ -54,8 +54,9 @@ Sema::CheckFunctionCall(Expr *Fn,
return true;
}
- FunctionTypeProto* proto =
- cast<FunctionTypeProto>(CurFunctionDecl->getType());
+ FunctionTypeProto* proto = CurFunctionDecl ?
+ cast<FunctionTypeProto>(CurFunctionDecl->getType()) :
+ cast<FunctionTypeProto>(ObjcGetTypeForMethodDefinition(CurMethodDecl));
if (!proto->isVariadic()) {
Diag(Fn->getLocStart(),
diag::err_va_start_used_in_non_variadic_function);
@@ -65,9 +66,10 @@ Sema::CheckFunctionCall(Expr *Fn,
bool SecondArgIsLastNamedArgument = false;
if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Args[1])) {
if (ParmVarDecl *PV = dyn_cast<ParmVarDecl>(DR->getDecl())) {
- ParmVarDecl *LastNamedArg =
- CurFunctionDecl->getParamDecl(CurFunctionDecl->getNumParams() - 1);
-
+ ParmVarDecl *LastNamedArg = CurFunctionDecl ?
+ CurFunctionDecl->getParamDecl(CurFunctionDecl->getNumParams() - 1) :
+ CurMethodDecl->getParamDecl(CurMethodDecl->getNumParams() - 1);
+
if (PV == LastNamedArg)
SecondArgIsLastNamedArgument = true;
}