[clang] [clang-format] js handle anonymous classes (PR #106242)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 09:16:02 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 32503050066ed307e6859b3c2ee6fbfa6327ca8b 32e94bde5a8ed401a9fb1255d8394c552da82dd7 --extensions cpp -- clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTestJS.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 7591eaeae4..506386526b 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4031,8 +4031,8 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
case tok::coloncolon:
break;
default:
- if (!JSPastExtendsOrImplements && !ClassName && Previous->is(tok::identifier) &&
- Previous->isNot(TT_AttributeMacro)) {
+ if (!JSPastExtendsOrImplements && !ClassName &&
+ Previous->is(tok::identifier) && Previous->isNot(TT_AttributeMacro)) {
ClassName = Previous;
}
}
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 734c1590c4..4b29ba720f 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -587,7 +587,6 @@ TEST_F(FormatTestJS, GoogAnonymousClass) {
"};");
}
-
TEST_F(FormatTestJS, IIFEs) {
// Internal calling parens; no semi.
verifyFormat("(function() {\n"
``````````
</details>
https://github.com/llvm/llvm-project/pull/106242
More information about the cfe-commits
mailing list