]> granicus.if.org Git - clang/commitdiff
Modules builds are necessarily compile actions, but they don't
authorEric Christopher <echristo@gmail.com>
Thu, 24 Mar 2016 00:34:02 +0000 (00:34 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 24 Mar 2016 00:34:02 +0000 (00:34 +0000)
necessarily produce object files. Turn off split dwarf if we're not
producing a file that the driver believes is an object file.

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

lib/Driver/Tools.cpp
test/Driver/split-debug.h [new file with mode: 0644]

index 7d69756647b0fb871b806a2587955c3abbcbddbd..e725e5af48836f02f293b9a1a90c6acff861c50e 100644 (file)
@@ -5737,7 +5737,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // Handle the debug info splitting at object creation time if we're
   // creating an object.
   // TODO: Currently only works on linux with newer objcopy.
-  if (SplitDwarf && !isa<CompileJobAction>(JA) && !isa<BackendJobAction>(JA))
+  if (SplitDwarf && Output.getType() == types::TY_Object)
     SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDwarfOut);
 
   if (Arg *A = Args.getLastArg(options::OPT_pg))
diff --git a/test/Driver/split-debug.h b/test/Driver/split-debug.h
new file mode 100644 (file)
index 0000000..bb05f30
--- /dev/null
@@ -0,0 +1,15 @@
+// Check that we aren't splitting debug output for modules builds that don't produce object files.
+//
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
+//
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -emit-module -fmodules-embed-all-files -fno-implicit-modules -fno-implicit-module-maps -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
+//
+// FIXME: This should fail using clang, except that the type of the output for
+// an object output with modules is given as clang::driver::types::TY_PCH
+// rather than TY_Object.
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -fmodule-format=obj -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
+//
+// CHECK-NO-ACTIONS-NOT: objcopy