[cfe-commits] r170914 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp
Nico Weber
nicolasweber at gmx.de
Fri Dec 21 10:21:56 PST 2012
Author: nico
Date: Fri Dec 21 12:21:56 2012
New Revision: 170914
URL: http://llvm.org/viewvc/llvm-project?rev=170914&view=rev
Log:
format: Handle #import as include directive too.
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=170914&r1=170913&r2=170914&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Dec 21 12:21:56 2012
@@ -579,6 +579,7 @@
return;
switch (Tokens[Index].Tok.getIdentifierInfo()->getPPKeywordID()) {
case tok::pp_include:
+ case tok::pp_import:
parseIncludeDirective();
break;
default:
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=170914&r1=170913&r2=170914&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Dec 21 12:21:56 2012
@@ -617,6 +617,12 @@
EXPECT_EQ("#include \"a/b/string\"\n", format("#include \"a/b/string\"\n"));
EXPECT_EQ("#include \"string.h\"\n", format("#include \"string.h\"\n"));
EXPECT_EQ("#include \"string.h\"\n", format("#include \"string.h\"\n"));
+
+ EXPECT_EQ("#import <string>\n", format("#import <string>\n"));
+ EXPECT_EQ("#import <a/b/c.h>\n", format("#import <a/b/c.h>\n"));
+ EXPECT_EQ("#import \"a/b/string\"\n", format("#import \"a/b/string\"\n"));
+ EXPECT_EQ("#import \"string.h\"\n", format("#import \"string.h\"\n"));
+ EXPECT_EQ("#import \"string.h\"\n", format("#import \"string.h\"\n"));
}
More information about the cfe-commits
mailing list