]> granicus.if.org Git - clang/commitdiff
Simplify CodeGenFunction::GenerateCode.
authorAnders Carlsson <andersca@mac.com>
Wed, 15 Apr 2009 04:10:19 +0000 (04:10 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 15 Apr 2009 04:10:19 +0000 (04:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69134 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 7ddc2213705f5d2f9b67b4d6f5bfa5b9ed5081a3..4bdebfe43157d533b1cf25a387f351f40167f083 100644 (file)
@@ -225,16 +225,11 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
                                     FProto->getArgType(i)));
   }
 
-  StartFunction(FD, FD->getResultType(), Fn, Args,
-                cast<CompoundStmt>(FD->getBody())->getLBracLoc());
+  const CompoundStmt *S = FD->getBody();
 
-  EmitStmt(FD->getBody());
-  
-  const CompoundStmt *S = dyn_cast<CompoundStmt>(FD->getBody());
-  if (S)
-    FinishFunction(S->getRBracLoc());
-  else
-    FinishFunction();
+  StartFunction(FD, FD->getResultType(), Fn, Args, S->getLBracLoc());
+  EmitStmt(S);
+  FinishFunction(S->getRBracLoc());
     
   // Destroy the 'this' declaration.
   if (CXXThisDecl)