summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-03-17 18:13:58 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-03-17 18:13:58 +0000
commitc2df16b6d36678af7cbdeb8c748d6a289988f49b (patch)
treec434842c181ef5e64bc924b333928f06a033a6af /llvm/lib/MC/MCDwarf.cpp
parentec47bc2baef059cd7ebb8c3befbb3aa6c9bb8ff5 (diff)
downloadbcm5719-llvm-c2df16b6d36678af7cbdeb8c748d6a289988f49b.tar.gz
bcm5719-llvm-c2df16b6d36678af7cbdeb8c748d6a289988f49b.zip
DebugInfo: Use MC line table file entry uniquing for non-asm input as well.
See r204027 for the precursor to this that applied to asm debug info. This required some non-obvious API changes to handle the case of asm output (we never go asm->asm so this didn't come up in r204027): the modification of the file/directory name by MCDwarfLineTableHeader needed to be reflected in the MCAsmStreamer caller so it could print the appropriate .file directive, so those StringRef parameters are now non-const ref (in/out) parameters rather than just const. llvm-svn: 204069
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 72ecfa6cb45..edeee20ab47 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -287,6 +287,7 @@ std::pair<MCSymbol *, MCSymbol *> MCDwarfLineTableHeader::Emit(MCStreamer *MCOS)
// Second the file table.
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
+ assert(!MCDwarfFiles[i].Name.empty());
MCOS->EmitBytes(MCDwarfFiles[i].Name); // FileName
MCOS->EmitBytes(StringRef("\0", 1)); // the null term. of the string
// the Directory num
@@ -331,14 +332,19 @@ const MCSymbol *MCDwarfLineTable::EmitCU(MCStreamer *MCOS) const {
return LineStartSym;
}
-unsigned MCDwarfLineTable::getFile(StringRef Directory, StringRef FileName,
+unsigned MCDwarfLineTable::getFile(StringRef &Directory, StringRef &FileName,
unsigned FileNumber) {
return Header.getFile(Directory, FileName, FileNumber);
}
-unsigned MCDwarfLineTableHeader::getFile(StringRef Directory,
- StringRef FileName,
+unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory,
+ StringRef &FileName,
unsigned FileNumber) {
+ if (FileName.empty()) {
+ FileName = "<stdin>";
+ Directory = "";
+ }
+ assert(!FileName.empty());
if (FileNumber == 0) {
FileNumber = SourceIdMap.size() + 1;
assert((MCDwarfFiles.empty() || FileNumber == MCDwarfFiles.size()) &&
OpenPOWER on IntegriCloud