File tree Expand file tree Collapse file tree 22 files changed +62
-48
lines changed Expand file tree Collapse file tree 22 files changed +62
-48
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,7 @@ void BracesAroundStatementsCheck::storeOptions(
105105}
106106
107107void BracesAroundStatementsCheck::registerMatchers (MatchFinder *Finder) {
108- Finder->addMatcher (
109- ifStmt (unless (allOf (isConstexpr (), isInTemplateInstantiation ())))
110- .bind (" if" ),
111- this );
108+ Finder->addMatcher (ifStmt ().bind (" if" ), this );
112109 Finder->addMatcher (whileStmt ().bind (" while" ), this );
113110 Finder->addMatcher (doStmt ().bind (" do" ), this );
114111 Finder->addMatcher (forStmt ().bind (" for" ), this );
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ class BracesAroundStatementsCheck : public ClangTidyCheck {
5555 template <typename IfOrWhileStmt>
5656 SourceLocation findRParenLoc (const IfOrWhileStmt *S, const SourceManager &SM,
5757 const ASTContext *Context);
58+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
59+ return TK_IgnoreUnlessSpelledInSource;
60+ }
5861
5962private:
6063 std::set<const Stmt *> ForceBracesStmts;
Original file line number Diff line number Diff line change @@ -171,8 +171,7 @@ void ElseAfterReturnCheck::registerPPCallbacks(const SourceManager &SM,
171171void ElseAfterReturnCheck::registerMatchers (MatchFinder *Finder) {
172172 const auto InterruptsControlFlow = stmt (anyOf (
173173 returnStmt ().bind (InterruptingStr), continueStmt ().bind (InterruptingStr),
174- breakStmt ().bind (InterruptingStr),
175- expr (ignoringImplicit (cxxThrowExpr ().bind (InterruptingStr)))));
174+ breakStmt ().bind (InterruptingStr), cxxThrowExpr ().bind (InterruptingStr)));
176175 Finder->addMatcher (
177176 compoundStmt (
178177 forEach (ifStmt (unless (isConstexpr ()),
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class ElseAfterReturnCheck : public ClangTidyCheck {
2828 Preprocessor *ModuleExpanderPP) override ;
2929 void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
3030 void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
31+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
32+ return TK_IgnoreUnlessSpelledInSource;
33+ }
3134
3235 using ConditionalBranchMap =
3336 llvm::DenseMap<FileID, SmallVector<SourceRange, 1 >>;
Original file line number Diff line number Diff line change @@ -294,8 +294,7 @@ void InconsistentDeclarationParameterNameCheck::storeOptions(
294294
295295void InconsistentDeclarationParameterNameCheck::registerMatchers (
296296 MatchFinder *Finder) {
297- Finder->addMatcher (functionDecl (unless (isImplicit ()), hasOtherDeclarations ())
298- .bind (" functionDecl" ),
297+ Finder->addMatcher (functionDecl (hasOtherDeclarations ()).bind (" functionDecl" ),
299298 this );
300299}
301300
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class InconsistentDeclarationParameterNameCheck : public ClangTidyCheck {
3333 void storeOptions (ClangTidyOptions::OptionMap &Opts) override ;
3434 void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
3535 void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
36+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
37+ return TK_IgnoreUnlessSpelledInSource;
38+ }
3639
3740private:
3841 void markRedeclarationsAsVisited (const FunctionDecl *FunctionDeclaration);
Original file line number Diff line number Diff line change @@ -106,11 +106,7 @@ void MisleadingIndentationCheck::missingBracesCheck(const SourceManager &SM,
106106}
107107
108108void MisleadingIndentationCheck::registerMatchers (MatchFinder *Finder) {
109- Finder->addMatcher (
110- ifStmt (allOf (hasElse (stmt ()),
111- unless (allOf (isConstexpr (), isInTemplateInstantiation ()))))
112- .bind (" if" ),
113- this );
109+ Finder->addMatcher (ifStmt (hasElse (stmt ())).bind (" if" ), this );
114110 Finder->addMatcher (
115111 compoundStmt (has (stmt (anyOf (ifStmt (), forStmt (), whileStmt ()))))
116112 .bind (" compound" ),
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ class MisleadingIndentationCheck : public ClangTidyCheck {
2727 : ClangTidyCheck(Name, Context) {}
2828 void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
2929 void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
30+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
31+ return TK_IgnoreUnlessSpelledInSource;
32+ }
3033
3134private:
3235 void danglingElseCheck (const SourceManager &SM, ASTContext *Context,
Original file line number Diff line number Diff line change @@ -18,18 +18,14 @@ namespace tidy {
1818namespace readability {
1919
2020void NamedParameterCheck::registerMatchers (ast_matchers::MatchFinder *Finder) {
21- Finder->addMatcher (functionDecl (unless ( isInstantiated ()) ).bind (" decl" ), this );
21+ Finder->addMatcher (functionDecl ().bind (" decl" ), this );
2222}
2323
2424void NamedParameterCheck::check (const MatchFinder::MatchResult &Result) {
2525 const SourceManager &SM = *Result.SourceManager ;
2626 const auto *Function = Result.Nodes .getNodeAs <FunctionDecl>(" decl" );
2727 SmallVector<std::pair<const FunctionDecl *, unsigned >, 4 > UnnamedParams;
2828
29- // Ignore implicitly generated members.
30- if (Function->isImplicit ())
31- return ;
32-
3329 // Ignore declarations without a definition if we're not dealing with an
3430 // overriden method.
3531 const FunctionDecl *Definition = nullptr ;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ class NamedParameterCheck : public ClangTidyCheck {
3232 : ClangTidyCheck(Name, Context) {}
3333 void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
3434 void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
35+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
36+ return TK_IgnoreUnlessSpelledInSource;
37+ }
3538};
3639
3740} // namespace readability
You can’t perform that action at this time.
0 commit comments