Fix -emit-codegen-only to not generate binaries
authorAlp Toker <alp@nuanti.com>
Tue, 3 Jun 2014 02:14:20 +0000 (02:14 +0000)
committerAlp Toker <alp@nuanti.com>
Tue, 3 Jun 2014 02:14:20 +0000 (02:14 +0000)
llvm-svn: 210059

clang/lib/CodeGen/CodeGenAction.cpp
clang/test/Frontend/disable-output.c [new file with mode: 0644]

index d337fa7..88f02b4 100644 (file)
@@ -568,6 +568,7 @@ static raw_ostream *GetOutputStream(CompilerInstance &CI,
   case Backend_EmitNothing:
     return nullptr;
   case Backend_EmitMCNull:
+    return new raw_null_ostream();
   case Backend_EmitObj:
     return CI.createDefaultOutputFile(true, InFile, "o");
   }
diff --git a/clang/test/Frontend/disable-output.c b/clang/test/Frontend/disable-output.c
new file mode 100644 (file)
index 0000000..786ac77
--- /dev/null
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -emit-llvm-only -triple=i386-apple-darwin -o %t
+// RUN: not rm %t
+// RUN: %clang_cc1 %s -emit-codegen-only -triple=i386-apple-darwin -o %t
+// RUN: not rm %t
+
+// Test that output is not generated when emission is disabled.