]> granicus.if.org Git - clang/commitdiff
Indicate success for simple options when clang called with -cc1.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 7 Aug 2013 12:54:47 +0000 (12:54 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 7 Aug 2013 12:54:47 +0000 (12:54 +0000)
Patch by David Wiberg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187888 91177308-0d34-0410-b5e6-96231b3b80d8

lib/FrontendTool/ExecuteCompilerInvocation.cpp
test/Frontend/cc1-return-codes.c [new file with mode: 0644]

index 53f373d4f7b6124cc1fafd9dc42eda115e3512bf..2f6d4b29b65ba00c2d7b1d7c41f2d0d4cd4100d5 100644 (file)
@@ -183,7 +183,7 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
     Opts->PrintHelp(llvm::outs(), "clang -cc1",
                     "LLVM 'Clang' Compiler: http://clang.llvm.org",
                     /*Include=*/ driver::options::CC1Option, /*Exclude=*/ 0);
-    return 0;
+    return true;
   }
 
   // Honor -version.
@@ -191,7 +191,7 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
   // FIXME: Use a better -version message?
   if (Clang->getFrontendOpts().ShowVersion) {
     llvm::cl::PrintVersionMessage();
-    return 0;
+    return true;
   }
 
   // Load any requested plugins.
@@ -223,7 +223,7 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
   // This should happen AFTER plugins have been loaded!
   if (Clang->getAnalyzerOpts()->ShowCheckerHelp) {
     ento::printCheckerHelp(llvm::outs(), Clang->getFrontendOpts().Plugins);
-    return 0;
+    return true;
   }
 #endif
 
diff --git a/test/Frontend/cc1-return-codes.c b/test/Frontend/cc1-return-codes.c
new file mode 100644 (file)
index 0000000..da329b9
--- /dev/null
@@ -0,0 +1,4 @@
+// cc1 immediate arguments (arguments which displays information and exits)
+// shall exit indicating success (return code 0)
+// RUN: %clang -cc1 -help
+// RUN: %clang -cc1 -version