[cfe-commits] r167469 - /cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp

NAKAMURA Takumi geek4civic at gmail.com
Tue Nov 6 14:57:28 PST 2012


2012/11/6 Fariborz Jahanian <fjahanian at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121106/1b8423d5/attachment.html>


More information about the cfe-commits mailing list