r264227 - Modules builds are necessarily compile actions, but they don't

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 17:34:03 PDT 2016


Author: echristo
Date: Wed Mar 23 19:34:02 2016
New Revision: 264227

URL: http://llvm.org/viewvc/llvm-project?rev=264227&view=rev
Log:
Modules builds are necessarily compile actions, but they don't
necessarily produce object files. Turn off split dwarf if we're not
producing a file that the driver believes is an object file.

Added:
    cfe/trunk/test/Driver/split-debug.h
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=264227&r1=264226&r2=264227&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Mar 23 19:34:02 2016
@@ -5737,7 +5737,7 @@ void Clang::ConstructJob(Compilation &C,
   // 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))

Added: cfe/trunk/test/Driver/split-debug.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.h?rev=264227&view=auto
==============================================================================
--- cfe/trunk/test/Driver/split-debug.h (added)
+++ cfe/trunk/test/Driver/split-debug.h Wed Mar 23 19:34:02 2016
@@ -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




More information about the cfe-commits mailing list