r299204 - clang-format: [JavaScript] Ignore QT keywords.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 31 05:04:38 PDT 2017
Author: djasper
Date: Fri Mar 31 07:04:37 2017
New Revision: 299204
URL: http://llvm.org/viewvc/llvm-project?rev=299204&view=rev
Log:
clang-format: [JavaScript] Ignore QT keywords.
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=299204&r1=299203&r2=299204&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Mar 31 07:04:37 2017
@@ -916,7 +916,9 @@ void UnwrappedLineParser::parseStructura
return;
}
}
- if (FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
+ if ((Style.Language == FormatStyle::LK_Cpp ||
+ Style.Language == FormatStyle::LK_ObjC) &&
+ FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
Keywords.kw_slots, Keywords.kw_qslots)) {
nextToken();
if (FormatTok->is(tok::colon)) {
Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=299204&r1=299203&r2=299204&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Mar 31 07:04:37 2017
@@ -167,6 +167,8 @@ TEST_F(FormatTestJS, ReservedWordsMethod
TEST_F(FormatTestJS, CppKeywords) {
// Make sure we don't mess stuff up because of C++ keywords.
verifyFormat("return operator && (aa);");
+ // .. or QT ones.
+ verifyFormat("slots: Slot[];");
}
TEST_F(FormatTestJS, ES6DestructuringAssignment) {
More information about the cfe-commits
mailing list