summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp6
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp5
2 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 1056d434200..5eb6e10554d 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -541,8 +541,8 @@ private:
}
} else {
while (CurrentToken) {
- if (CurrentToken->is(tok::string_literal))
- // Mark these string literals as "implicit" literals, too, so that
+ if (CurrentToken->isNot(tok::comment))
+ // Mark these tokens as "implicit" string literals, so that
// they are not split or line-wrapped.
CurrentToken->Type = TT_ImplicitStringLiteral;
next();
@@ -622,7 +622,7 @@ public:
// should not break the line).
IdentifierInfo *Info = CurrentToken->Tok.getIdentifierInfo();
if (Info && Info->getPPKeywordID() == tok::pp_import &&
- CurrentToken->Next && CurrentToken->Next->is(tok::string_literal)) {
+ CurrentToken->Next) {
next();
parseIncludeDirective();
return LT_Other;
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index 2b05ca49374..126b163c600 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -163,5 +163,10 @@ TEST_F(FormatTestJava, SynchronizedKeyword) {
"}");
}
+TEST_F(FormatTestJava, ImportDeclarations) {
+ verifyFormat("import some.really.loooooooooooooooooooooong.imported.Class;",
+ getStyleWithColumns(50));
+}
+
} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud