simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45235 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp
index 8bb263e..46afe7f 100644
--- a/Sema/SemaChecking.cpp
+++ b/Sema/SemaChecking.cpp
@@ -125,6 +125,8 @@
   return false;
 }
 
+/// SemaBuiltinVAStart - Check the arguments to __builtin_va_start for validity.
+/// Emit an error and return true on failure, return false on success.
 bool Sema::SemaBuiltinVAStart(Expr *Fn, Expr** Args, unsigned NumArgs) {
   if (NumArgs > 2) {
     Diag(Args[2]->getLocStart(), 
@@ -133,14 +135,15 @@
     return true;
   }
   
-  FunctionTypeProto *Proto;
+  // Determine whether the current function is variadic or not.
+  bool isVariadic;
   if (CurFunctionDecl)
-    Proto = cast<FunctionTypeProto>(CurFunctionDecl->getType());
+    isVariadic =
+      cast<FunctionTypeProto>(CurFunctionDecl->getType())->isVariadic();
   else
-    Proto =
-      cast<FunctionTypeProto>(ObjcGetTypeForMethodDefinition(CurMethodDecl));
+    isVariadic = CurMethodDecl->isVariadic();
   
-  if (!Proto->isVariadic()) {
+  if (!isVariadic) {
     Diag(Fn->getLocStart(), diag::err_va_start_used_in_non_variadic_function);
     return true;
   }