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
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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits