<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 14, 2011, at 7:10 PM, Nick Lewycky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="gmail_quote"><div><br></div><div>Please review!</div></div></blockquote></div></blockquote><br></div><blockquote type="cite"><br>Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>===================================================================<br>--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 142035)<br>+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br>@@ -442,23 +442,21 @@<br> if (FileName.empty())<br> return GetOrCreateSourceID("<stdin>", StringRef());<br> <br>- // MCStream expects full path name as filename.<br>- if (!DirName.empty() && !sys::path::is_absolute(FileName)) {<br>- SmallString<128> FullPathName = DirName;<br>- sys::path::append(FullPathName, FileName);<br>- // Here FullPathName will be copied into StringMap by GetOrCreateSourceID.<br>- return GetOrCreateSourceID(StringRef(FullPathName), StringRef());<br>- }<br>+ unsigned SrcId = SourceIdMap.size()+1;<br>+ std::pair<std::string, std::string> SourceName =<br>+ std::make_pair(FileName, DirName);<br>+ std::pair<std::pair<std::string, std::string>, unsigned> Entry =<br>+ make_pair(SourceName, SrcId);<br> <br>- StringMapEntry<unsigned> &Entry = SourceIdMap.GetOrCreateValue(FileName);<br>- if (Entry.getValue())<br>- return Entry.getValue();<br>+ std::map<std::pair<std::string, std::string>, unsigned>::iterator I;<br>+ bool NewlyInserted;<br>+ tie(I, NewlyInserted) = SourceIdMap.insert(Entry);<br>+ if (!NewlyInserted)<br>+ return I->second;<br> <br>- unsigned SrcId = SourceIdMap.size();<br>- Entry.setValue(SrcId);<br>-<br> // Print out a .file directive to specify files for .loc directives.<br>- Asm->OutStreamer.EmitDwarfFileDirective(SrcId, Entry.getKey());<br>+ Asm->OutStreamer.EmitDwarfFileDirective(SrcId, Entry.first.second,<br>+ Entry.first.first);<br> <br> return SrcId;<br> }<br>Index: lib/CodeGen/AsmPrinter/DwarfDebug.h<br>===================================================================<br>--- lib/CodeGen/AsmPrinter/DwarfDebug.h<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 142035)<br>+++ lib/CodeGen/AsmPrinter/DwarfDebug.h<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br>@@ -26,6 +26,7 @@<br> #include "llvm/ADT/UniqueVector.h"<br> #include "llvm/Support/Allocator.h"<br> #include "llvm/Support/DebugLoc.h"<br>+#include <map><br> <br> namespace llvm {<br> <br>@@ -207,9 +208,9 @@<br> ///<br> std::vector<DIEAbbrev *> Abbreviations;<br> <br>- /// SourceIdMap - Source id map, i.e. pair of directory id and source file<br>- /// id mapped to a unique id.<br>- StringMap<unsigned> SourceIdMap;<br>+ /// SourceIdMap - Source id map, i.e. pair of source filename and directory<br>+ /// mapped to a unique id.<br>+ std::map<std::pair<std::string, std::string>, unsigned> SourceIdMap;<br> <br> /// StringPool - A String->Symbol mapping of strings used by indirect<br><div><div> /// references.</div></div></blockquote><div></div><div><div><br></div></div>Why do you need this change in DwarfDebug ? Why can't MCAsmStreamer split file and directly ?<div>-</div><div>Devang</div></body></html>