[PATCH] [2/6] Convert non-printing characters to their octal sequence before emitting #line directive or __FILE__ macro
Eli Friedman
eli.friedman at gmail.com
Wed Sep 11 13:28:42 PDT 2013
On Wed, Sep 11, 2013 at 1:07 PM, Yunzhong Gao <
Yunzhong_Gao at playstation.sony.com> wrote:
> Hi Eli,
> Thanks for the hint. Looks like you already fixed #line directive in
> r189557. So what is left to fix is just the __FILE__ macro. I have updated
> my patch here.
> - Gao.
>
> http://llvm-reviews.chandlerc.com/D1291
>
> CHANGE SINCE LAST DIFF
> http://llvm-reviews.chandlerc.com/D1291?vs=3212&id=4207#toc
>
> Files:
> lib/Lex/PPMacroExpansion.cpp
> test/Preprocessor/line-directive-output.c
>
> Index: lib/Lex/PPMacroExpansion.cpp
> ===================================================================
> --- lib/Lex/PPMacroExpansion.cpp
> +++ lib/Lex/PPMacroExpansion.cpp
> @@ -1317,8 +1317,9 @@
> SmallString<128> FN;
> if (PLoc.isValid()) {
> FN += PLoc.getFilename();
> - Lexer::Stringify(FN);
> - OS << '"' << FN.str() << '"';
> + OS << '"';
> + OS.write_escaped(FN);
> + OS << '"';
> }
> Tok.setKind(tok::string_literal);
> } else if (II == Ident__DATE__) {
> Index: test/Preprocessor/line-directive-output.c
> ===================================================================
> --- test/Preprocessor/line-directive-output.c
> +++ test/Preprocessor/line-directive-output.c
> @@ -76,3 +76,8 @@
>
> // CHECK: # 50 "a\n.c"
> # 50 "a\012.c"
> +
> +// CHECK: # 100 "\202\261\202\361\202\311\202\277\202\315.c"
> +// CHECK: filename = "\202\261\202\361\202\311\202\277\202\315.c";
> +# 100 "\202\261\202\361\202\311\202\277\202\315.c"
> +const char *filename = __FILE__;
> \ No newline at end of file
>
Missing newline?
Otherwise, LGTM.
-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130911/f66322c4/attachment.html>
More information about the cfe-commits
mailing list