summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-09-16 20:57:49 +0000
committerDevang Patel <dpatel@apple.com>2010-09-16 20:57:49 +0000
commit871d0b1b1ce6611c1aa8765ab65083b583d692c8 (patch)
treeb1199f70124936012b6ea43d45054b603204a4ce /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent6c17c0807e7dca854e469a0fbebcbd1f10bd9af0 (diff)
downloadbcm5719-llvm-871d0b1b1ce6611c1aa8765ab65083b583d692c8.tar.gz
bcm5719-llvm-871d0b1b1ce6611c1aa8765ab65083b583d692c8.zip
If FE forgot to provide a file name (usually it uses "stdin" as name in such situation) then make one up to ensure that debug info is not malformed.
llvm-svn: 114119
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index c886a5ecc61..8e3c1f12ff1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1750,6 +1750,10 @@ unsigned DwarfDebug::GetOrCreateSourceID(StringRef DirName, StringRef FileName){
unsigned DId;
assert (DirName.empty() == false && "Invalid directory name!");
+ // If FE did not provide a file name, then assume stdin.
+ if (FileName.empty())
+ return GetOrCreateSourceID(DirName, "<stdin>");
+
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
if (DI != DirectoryIdMap.end()) {
DId = DI->getValue();
OpenPOWER on IntegriCloud