]> granicus.if.org Git - clang/commitdiff
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)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210059 91177308-0d34-0410-b5e6-96231b3b80d8

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

index d337fa7c431c1447d56349847dba02e7118afe50..88f02b4e6a0c21833366ac9ee451badae322774d 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/test/Frontend/disable-output.c b/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.