[llvm] r303299 - [llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Bob Haarman via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 13:46:49 PDT 2017
Author: inglorion
Date: Wed May 17 15:46:48 2017
New Revision: 303299
URL: http://llvm.org/viewvc/llvm-project?rev=303299&view=rev
Log:
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.
Reviewers: amccarth, zturner
Reviewed By: zturner
Subscribers: fhahn, llvm-commits
Differential Revision: https://reviews.llvm.org/D33296
Modified:
llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp?rev=303299&r1=303298&r2=303299&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp Wed May 17 15:46:48 2017
@@ -117,6 +117,7 @@ Expected<uint32_t> PDBFileBuilder::getNa
}
Error PDBFileBuilder::commit(StringRef Filename) {
+ assert(!Filename.empty());
auto ExpectedLayout = finalizeMsfLayout();
if (!ExpectedLayout)
return ExpectedLayout.takeError();
Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=303299&r1=303298&r2=303299&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Wed May 17 15:46:48 2017
@@ -67,6 +67,7 @@
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Regex.h"
@@ -365,9 +366,9 @@ cl::opt<std::string>
YamlPdbOutputFile("pdb", cl::desc("the name of the PDB file to write"),
cl::sub(YamlToPdbSubcommand));
-cl::list<std::string> InputFilename(cl::Positional,
- cl::desc("<input YAML file>"), cl::Required,
- cl::sub(YamlToPdbSubcommand));
+cl::opt<std::string> InputFilename(cl::Positional,
+ cl::desc("<input YAML file>"), cl::Required,
+ cl::sub(YamlToPdbSubcommand));
}
namespace pdb2yaml {
@@ -894,7 +895,12 @@ int main(int argc_, const char *argv_[])
if (opts::PdbToYamlSubcommand) {
pdb2Yaml(opts::pdb2yaml::InputFilename.front());
} else if (opts::YamlToPdbSubcommand) {
- yamlToPdb(opts::yaml2pdb::InputFilename.front());
+ if (opts::yaml2pdb::YamlPdbOutputFile.empty()) {
+ SmallString<16> OutputFilename(opts::yaml2pdb::InputFilename.getValue());
+ sys::path::replace_extension(OutputFilename, ".pdb");
+ opts::yaml2pdb::YamlPdbOutputFile = OutputFilename.str();
+ }
+ yamlToPdb(opts::yaml2pdb::InputFilename);
} else if (opts::AnalyzeSubcommand) {
dumpAnalysis(opts::analyze::InputFilename.front());
} else if (opts::PrettySubcommand) {
More information about the llvm-commits
mailing list