2012/11/6 Fariborz Jahanian <fjahan...@apple.com> > Author: fjahanian > Date: Tue Nov 6 11:30:23 2012 > New Revision: 167469 > > URL: http://llvm.org/viewvc/llvm-project?rev=167469&view=rev > Log: > Modern objective-C translator: Start adding line info to the > translated source where it is needed. wip. > > Modified: > cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp > > Modified: cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp?rev=167469&r1=167468&r2=167469&view=diff > > ============================================================================== > --- cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp (original) > +++ cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp Tue Nov 6 > 11:30:23 2012 > @@ -278,6 +278,7 @@ > // Syntactic Rewriting. > void RewriteRecordBody(RecordDecl *RD); > void RewriteInclude(); > + void RewriteLineDirective(const Decl *D); > void RewriteForwardClassDecl(DeclGroupRef D); > void RewriteForwardClassDecl(const llvm::SmallVector<Decl*, 8> &DG); > void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl, > @@ -3075,6 +3076,34 @@ > return FD->getTypeSpecStartLoc(); > } > > +void RewriteModernObjC::RewriteLineDirective(const Decl *D) { > + > + SourceLocation Location = D->getLocation(); > + > + if (Location.isFileID()) { > + std::string LineString("#line "); > + PresumedLoc PLoc = SM->getPresumedLoc(Location); > + LineString += utostr(PLoc.getLine()); > + LineString += " \""; > + LineString += PLoc.getFilename(); >
The file name on #line directive should be escaped, especially for win32. Tweaked in r167497.
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits