]> granicus.if.org Git - clang/commitdiff
use early returns to simplify and de-nest
authorSean Silva <silvas@purdue.edu>
Sun, 6 Jan 2013 07:49:41 +0000 (07:49 +0000)
committerSean Silva <silvas@purdue.edu>
Sun, 6 Jan 2013 07:49:41 +0000 (07:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/FrontendTool/ExecuteCompilerInvocation.cpp

index 8cc25924f2b52949ec1a374855cd0b58ee032c56..ad8eb04768bcb5aa86545ca36756be78b014bb55 100644 (file)
@@ -226,16 +226,14 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
 #endif
 
   // If there were errors in processing arguments, don't do anything else.
-  bool Success = false;
-  if (!Clang->getDiagnostics().hasErrorOccurred()) {
-    // Create and execute the frontend action.
-    OwningPtr<FrontendAction> Act(CreateFrontendAction(*Clang));
-    if (Act) {
-      Success = Clang->ExecuteAction(*Act);
-      if (Clang->getFrontendOpts().DisableFree)
-        Act.take();
-    }
-  }
-
+  if (Clang->getDiagnostics().hasErrorOccurred())
+    return false;
+  // Create and execute the frontend action.
+  OwningPtr<FrontendAction> Act(CreateFrontendAction(*Clang));
+  if (!Act)
+    return false;
+  bool Success = Clang->ExecuteAction(*Act);
+  if (Clang->getFrontendOpts().DisableFree)
+    Act.take();
   return Success;
 }