summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1f606a999e9deaa2dc4d7b39a3c332efb8ed9c5b (patch)
tree701a0cc5983d44b88e88a8bdbc854fa166cb8188 /clang/Sema/SemaChecking.cpp
parentcd8a89b3cdb289374ff081f1d9a40905ea4ad196 (diff)
downloadbcm5719-llvm-1f606a999e9deaa2dc4d7b39a3c332efb8ed9c5b.tar.gz
bcm5719-llvm-1f606a999e9deaa2dc4d7b39a3c332efb8ed9c5b.zip
Simplified setting up Method's scope before generating AST for its nody.
llvm-svn: 44576
Diffstat (limited to 'clang/Sema/SemaChecking.cpp')
-rw-r--r--clang/Sema/SemaChecking.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/Sema/SemaChecking.cpp b/clang/Sema/SemaChecking.cpp
index 81a18c9645f..b83e5120a1c 100644
--- a/clang/Sema/SemaChecking.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud