]> granicus.if.org Git - clang/commitdiff
Re-land "Emit proper CodeView when -gcodeview is passed without the cl driver."
authorReid Kleckner <rnk@google.com>
Mon, 26 Feb 2018 22:55:33 +0000 (22:55 +0000)
committerReid Kleckner <rnk@google.com>
Mon, 26 Feb 2018 22:55:33 +0000 (22:55 +0000)
Reverts r326116 and re-lands r326113 with a fix to ASan so that it
enables column info in its test suite.

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

lib/Driver/ToolChains/Clang.cpp
test/Driver/codeview-column-info.c [new file with mode: 0644]

index a2248ddaa908867fbde6aea97aee112b72377b3c..6ad38bc0e403085a3ecece153f929f06c72fc523 100644 (file)
@@ -2968,7 +2968,7 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
 
   // Forward -gcodeview. EmitCodeView might have been set by CL-compatibility
   // argument parsing.
-  if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
+  if (EmitCodeView) {
     // DWARFVersion remains at 0 if no explicit choice was made.
     CmdArgs.push_back("-gcodeview");
   } else if (DWARFVersion == 0 &&
@@ -3567,6 +3567,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   types::ID InputType = Input.getType();
   if (D.IsCLMode())
     AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind, &EmitCodeView);
+  else
+    EmitCodeView = Args.hasArg(options::OPT_gcodeview);
 
   const Arg *SplitDWARFArg = nullptr;
   RenderDebugOptions(getToolChain(), D, RawTriple, Args, EmitCodeView,
diff --git a/test/Driver/codeview-column-info.c b/test/Driver/codeview-column-info.c
new file mode 100644 (file)
index 0000000..9f2f016
--- /dev/null
@@ -0,0 +1,13 @@
+// Check that -dwarf-column-info does not get added to the cc1 line:
+// 1) When -gcodeview is present via the clang or clang++ driver
+// 2) When /Z7 is present via the cl driver.
+
+// RUN: %clang -### -c -g -gcodeview %s 2> %t1
+// RUN: FileCheck < %t1 %s
+// RUN: %clangxx -### -c -g -gcodeview %s 2> %t2
+// RUN: FileCheck < %t2 %s
+// RUN: %clang_cl -### /c /Z7 %s 2> %t2
+// RUN: FileCheck < %t2 %s
+
+// CHECK: "-cc1"
+// CHECK-NOT: "-dwarf-column-info"