2012/11/6 Fariborz Jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com" target="_blank">fjahanian@apple.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Author: fjahanian<br>
Date: Tue Nov  6 11:30:23 2012<br>
New Revision: 167469<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=167469&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=167469&view=rev</a><br>
Log:<br>
Modern objective-C translator: Start adding line info to the<br>
translated source where it is needed. wip.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp<br>
<br>
Modified: cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp?rev=167469&r1=167468&r2=167469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp?rev=167469&r1=167468&r2=167469&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp (original)<br>
+++ cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp Tue Nov  6 11:30:23 2012<br>
@@ -278,6 +278,7 @@<br>
     // Syntactic Rewriting.<br>
     void RewriteRecordBody(RecordDecl *RD);<br>
     void RewriteInclude();<br>
+    void RewriteLineDirective(const Decl *D);<br>
     void RewriteForwardClassDecl(DeclGroupRef D);<br>
     void RewriteForwardClassDecl(const llvm::SmallVector<Decl*, 8> &DG);<br>
     void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,<br>
@@ -3075,6 +3076,34 @@<br>
   return FD->getTypeSpecStartLoc();<br>
 }<br>
<br>
+void RewriteModernObjC::RewriteLineDirective(const Decl *D) {<br>
+<br>
+  SourceLocation Location = D->getLocation();<br>
+<br>
+  if (Location.isFileID()) {<br>
+    std::string LineString("#line ");<br>
+    PresumedLoc PLoc = SM->getPresumedLoc(Location);<br>
+    LineString += utostr(PLoc.getLine());<br>
+    LineString += " \"";<br>
+    LineString += PLoc.getFilename();<br></blockquote><div><br></div><div>The file name on #line directive should be escaped, especially for win32. Tweaked in r<span style="font-family:arial,sans-serif;font-size:14px">167497.</span></div>
</div></div>