[PATCH] D71980: Fix ClangTidy Bug - 44229, 33203 and 32204
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 29 14:40:55 PST 2019
njames93 updated this revision to Diff 235525.
njames93 added a comment.
Forgot to clang-format...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71980/new/
https://reviews.llvm.org/D71980
Files:
clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
Index: clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
@@ -106,7 +106,11 @@
}
void MisleadingIndentationCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(ifStmt(hasElse(stmt())).bind("if"), this);
+ Finder->addMatcher(
+ ifStmt(unless(allOf(isConstexpr(), isInTemplateInstantiation())),
+ hasElse(stmt()))
+ .bind("if"),
+ this);
Finder->addMatcher(
compoundStmt(has(stmt(anyOf(ifStmt(), forStmt(), whileStmt()))))
.bind("compound"),
Index: clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -123,7 +123,10 @@
}
void BracesAroundStatementsCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(ifStmt().bind("if"), this);
+ Finder->addMatcher(
+ ifStmt(unless(allOf(isConstexpr(), isInTemplateInstantiation())))
+ .bind("if"),
+ this);
Finder->addMatcher(whileStmt().bind("while"), this);
Finder->addMatcher(doStmt().bind("do"), this);
Finder->addMatcher(forStmt().bind("for"), this);
Index: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
@@ -59,7 +59,8 @@
void BranchCloneCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- ifStmt(stmt().bind("if"),
+ ifStmt(unless(allOf(isConstexpr(), isInTemplateInstantiation())),
+ stmt().bind("if"),
hasParent(stmt(unless(ifStmt(hasElse(equalsBoundNode("if")))))),
hasElse(stmt().bind("else"))),
this);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71980.235525.patch
Type: text/x-patch
Size: 2143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191229/49028ca6/attachment-0001.bin>
More information about the cfe-commits
mailing list