r207955 - clang-format: Fix import statements with ColumnLimit: 0
Daniel Jasper
djasper at google.com
Mon May 5 01:08:07 PDT 2014
Author: djasper
Date: Mon May 5 03:08:07 2014
New Revision: 207955
URL: http://llvm.org/viewvc/llvm-project?rev=207955&view=rev
Log:
clang-format: Fix import statements with ColumnLimit: 0
These used to interact badly with AlwaysBreakBeforeMultilineStrings.
Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=207955&r1=207954&r2=207955&view=diff
==============================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Mon May 5 03:08:07 2014
@@ -1012,7 +1012,7 @@ unsigned ContinuationIndenter::getColumn
bool ContinuationIndenter::nextIsMultilineString(const LineState &State) {
const FormatToken &Current = *State.NextToken;
- if (!Current.isStringLiteral())
+ if (!Current.isStringLiteral() || Current.Type == TT_ImplicitStringLiteral)
return false;
// We never consider raw string literals "multiline" for the purpose of
// AlwaysBreakBeforeMultilineStrings implementation as they are special-cased
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=207955&r1=207954&r2=207955&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon May 5 03:08:07 2014
@@ -4928,6 +4928,11 @@ TEST_F(FormatTest, HandlesIncludeDirecti
// Protocol buffer definition or missing "#".
verifyFormat("import \"aaaaaaaaaaaaaaaaa/aaaaaaaaaaaaaaa\";",
getLLVMStyleWithColumns(30));
+
+ FormatStyle Style = getLLVMStyle();
+ Style.AlwaysBreakBeforeMultilineStrings = true;
+ Style.ColumnLimit = 0;
+ verifyFormat("#import \"abc.h\"", Style);
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list