r238845 - clang-format: Don't try to detect C++ lambdas in other languages.
Daniel Jasper
djasper at google.com
Tue Jun 2 08:31:37 PDT 2015
Author: djasper
Date: Tue Jun 2 10:31:37 2015
New Revision: 238845
URL: http://llvm.org/viewvc/llvm-project?rev=238845&view=rev
Log:
clang-format: Don't try to detect C++ lambdas in other languages.
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=238845&r1=238844&r2=238845&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Tue Jun 2 10:31:37 2015
@@ -911,6 +911,10 @@ void UnwrappedLineParser::parseStructura
}
bool UnwrappedLineParser::tryToParseLambda() {
+ if (Style.Language != FormatStyle::LK_Cpp) {
+ nextToken();
+ return false;
+ }
// FIXME: This is a dirty way to access the previous token. Find a better
// solution.
if (!Line->Tokens.empty() &&
Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=238845&r1=238844&r2=238845&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Jun 2 10:31:37 2015
@@ -266,6 +266,8 @@ TEST_F(FormatTestJS, ArrayLiterals) {
" bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
" ccccccccccccccccccccccccccc\n"
"]);");
+
+ verifyFormat("someFunction([], {a: a});");
}
TEST_F(FormatTestJS, FunctionLiterals) {
More information about the cfe-commits
mailing list