[PATCH] Don't divide L and #x in macro definitions. Fixes http://llvm.org/PR17144
Alexander Kornienko
alexfh at google.com
Tue Sep 10 06:40:56 PDT 2013
Hi djasper,
http://llvm-reviews.chandlerc.com/D1639
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1286,6 +1286,8 @@
return false;
if (Left.Type == TT_BlockComment && Left.TokenText.endswith("=*/"))
return false;
+ if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L")
+ return false;
return true;
}
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -1930,6 +1930,7 @@
}
TEST_F(FormatTest, HashInMacroDefinition) {
+ EXPECT_EQ("#define A(c) L#c", format("#define A(c) L#c", getLLVMStyle()));
verifyFormat("#define A \\\n b #c;", getLLVMStyleWithColumns(11));
verifyFormat("#define A \\\n"
" { \\\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1639.1.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130910/50964179/attachment.bin>
More information about the cfe-commits
mailing list