aboutsummaryrefslogtreecommitdiff
path: root/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
commit1905a18abcb46e6a57eeaa291cd81fc669cedfd0 (patch)
treea92973fc74a9dbbfae529eae3042a739ede55797 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent4e282decf3960bfa6b1fe3fd77bb51ff96121515 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index c886a5ecc6..8e3c1f12ff 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/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();