aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-04-25 16:24:19 +0000
committerHans Wennborg <hans@hanshq.net>2014-04-25 16:24:19 +0000
commitb67bacf5c681998d875faaa0c3c47c8dea71fccb (patch)
treebd161151122d27641664d24c48945452b4e5e2cf
parent7225262c2ab37c7f678921948facf3bdecc3b256 (diff)
downloadclang_35a-b67bacf5c681998d875faaa0c3c47c8dea71fccb.tar.gz
clang-cl: pass -debug flag to the linker when compiling with debug info
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207233 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/Tools.cpp4
-rw-r--r--test/Driver/cl-link.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 0a45fa190a..924e040246 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7435,6 +7435,10 @@ void visualstudio::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-nologo");
+ if (Args.hasArg(options::OPT_g_Group)) {
+ CmdArgs.push_back("-debug");
+ }
+
bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd);
if (DLL) {
diff --git a/test/Driver/cl-link.c b/test/Driver/cl-link.c
index 24e0702c8a..309c27dab1 100644
--- a/test/Driver/cl-link.c
+++ b/test/Driver/cl-link.c
@@ -31,3 +31,7 @@
// ASAN-DLL: "-incremental:no"
// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib"
// ASAN-DLL: "{{.*}}cl-link{{.*}}.obj"
+
+// RUN: %clang_cl /Zi /Tc%s -### 2>&1 | FileCheck --check-prefix=DEBUG %s
+// DEBUG: link.exe
+// DEBUG: "-debug"