diff options
author | Daniel Jasper <djasper@google.com> | 2017-03-31 12:04:37 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2017-03-31 12:04:37 +0000 |
commit | 72b3357f2d39adb0cf88fef992cd2570452d90ac (patch) | |
tree | a61cce20923f3f423c5c8212458d86d9146cc53d | |
parent | f698a69107e39727d81d2ed1dd51445981adede7 (diff) | |
download | bcm5719-llvm-72b3357f2d39adb0cf88fef992cd2570452d90ac.tar.gz bcm5719-llvm-72b3357f2d39adb0cf88fef992cd2570452d90ac.zip |
clang-format: [JavaScript] Ignore QT keywords.
llvm-svn: 299204
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 4 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 25bc99118f8..a0354a32a89 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -916,7 +916,9 @@ void UnwrappedLineParser::parseStructuralElement() { 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)) { diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 62d7ec86c91..f24ddc8fa2c 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -167,6 +167,8 @@ TEST_F(FormatTestJS, ReservedWordsMethods) { 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) { |