[PATCH] D41310: [COFF] Clean up debug option handling
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 16:24:16 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320896: [COFF] Clean up debug option handling (authored by smeenai, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D41310
Files:
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/Options.td
lld/trunk/test/COFF/debug-dwarf.test
lld/trunk/test/COFF/nopdb.test
Index: lld/trunk/test/COFF/debug-dwarf.test
===================================================================
--- lld/trunk/test/COFF/debug-dwarf.test
+++ lld/trunk/test/COFF/debug-dwarf.test
@@ -0,0 +1,19 @@
+# Check that /debug creates %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: ls %t.pdb
+
+# Check that /debug:dwarf does not create %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug:dwarf /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: not ls %t.pdb
+
+# Check that /debug:dwarf /debug creates %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug:dwarf /debug /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: ls %t.pdb
+
+# Check that /debug:dwarf /pdb:%t.pdb does not create %t.pdb.
+# RUN: rm -f %t.pdb
+# RUN: lld-link /debug:dwarf /pdb:%t.pdb /entry:main /out:%t.exe %p/Inputs/ret42.obj
+# RUN: not ls %t.pdb
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -818,8 +818,10 @@
}
// Handle /pdb
- if (auto *Arg = Args.getLastArg(OPT_pdb))
- Config->PDBPath = Arg->getValue();
+ bool ShouldCreatePDB = Args.hasArg(OPT_debug, OPT_debug_ghash);
+ if (ShouldCreatePDB)
+ if (auto *Arg = Args.getLastArg(OPT_pdb))
+ Config->PDBPath = Arg->getValue();
// Handle /noentry
if (Args.hasArg(OPT_noentry)) {
@@ -1145,15 +1147,11 @@
}
// Put the PDB next to the image if no /pdb flag was passed.
- if (Config->Debug && Config->PDBPath.empty()) {
+ if (ShouldCreatePDB && Config->PDBPath.empty()) {
Config->PDBPath = Config->OutputFile;
sys::path::replace_extension(Config->PDBPath, ".pdb");
}
- // Disable PDB generation if the user requested it.
- if (Args.hasArg(OPT_nopdb, OPT_debug_dwarf))
- Config->PDBPath = "";
-
// Set default image base if /base is not given.
if (Config->ImageBase == uint64_t(-1))
Config->ImageBase = getDefaultImageBase();
Index: lld/trunk/COFF/Options.td
===================================================================
--- lld/trunk/COFF/Options.td
+++ lld/trunk/COFF/Options.td
@@ -120,7 +120,6 @@
def debug_ghash : F<"debug:ghash">;
def debug_dwarf : F<"debug:dwarf">;
def export_all_symbols : F<"export-all-symbols">;
-def nopdb : F<"nopdb">, HelpText<"Disable PDB generation for DWARF users">;
def lldmingw : F<"lldmingw">;
def msvclto : F<"msvclto">;
def output_def : Joined<["/", "-"], "output-def:">;
Index: lld/trunk/test/COFF/nopdb.test
===================================================================
--- lld/trunk/test/COFF/nopdb.test
+++ lld/trunk/test/COFF/nopdb.test
@@ -1,14 +0,0 @@
-# Check that /debug creates %t.pdb.
-# RUN: rm -f %t.pdb
-# RUN: lld-link /debug /entry:main /out:%t.exe %p/Inputs/ret42.obj
-# RUN: ls %t.pdb
-
-# Check that /debug /nopdb does not create %t.pdb.
-# RUN: rm -f %t.pdb
-# RUN: lld-link /debug /nopdb /entry:main /out:%t.exe %p/Inputs/ret42.obj
-# RUN: not ls %t.pdb
-
-# Check that /debug /nopdb /pdb:%t.pdb does not create %t.pdb.
-# RUN: rm -f %t.pdb
-# RUN: lld-link /debug /nopdb /pdb:%t.pdb /entry:main /out:%t.exe %p/Inputs/ret42.obj
-# RUN: not ls %t.pdb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41310.127204.patch
Type: text/x-patch
Size: 3206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171216/8f9e30fd/attachment.bin>
More information about the llvm-commits
mailing list