[PATCH] D31224: [COFF] Put the PDB next to the image if the user doesn't pass /PDB:

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 17:30:57 PDT 2017


rnk created this revision.

This is compatible with MSVC link.exe.


https://reviews.llvm.org/D31224

Files:
  COFF/Config.h
  COFF/Driver.cpp


Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -890,6 +890,12 @@
         getOutputPath((*Args.filtered_begin(OPT_INPUT))->getValue());
   }
 
+  // Put the PDB next to the image if no /pdb flag was passed.
+  if (Config->Debug && Config->PDBPath.empty()) {
+    Config->PDBPath = Config->OutputFile;
+    llvm::sys::path::replace_extension(Config->PDBPath, ".pdb");
+  }
+
   // Set default image base if /base is not given.
   if (Config->ImageBase == uint64_t(-1))
     Config->ImageBase = getDefaultImageBase();
Index: COFF/Config.h
===================================================================
--- COFF/Config.h
+++ COFF/Config.h
@@ -89,7 +89,7 @@
   bool Debug = false;
   bool WriteSymtab = true;
   unsigned DebugTypes = static_cast<unsigned>(DebugType::None);
-  StringRef PDBPath;
+  llvm::SmallString<128> PDBPath;
 
   // Symbols in this set are considered as live by the garbage collector.
   std::set<SymbolBody *> GCRoot;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31224.92573.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170322/c54dd82b/attachment.bin>


More information about the llvm-commits mailing list