[PATCH] D32743: [clang-tidy] Add new cert-dcl21-cpp check.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 05:18:12 PDT 2017


alexfh added inline comments.


================
Comment at: clang-tidy/cert/PostfixOperatorCheck.cpp:27
+                                        hasOverloadedOperatorName("--")))
+                         .bind("decl"),
+                     this);
----------------
JonasToth wrote:
> could the `,this);` be on this line? seems odd.
Just let clang-format do its job, no need for manual tuning.

```
  Finder->addMatcher(functionDecl(anyOf(hasOverloadedOperatorName("++"),
                                        hasOverloadedOperatorName("--")))
                         .bind("decl"),
                     this);
```

In this specific case `this` being on a separate line is reasonable, since the first argument of `addMatcher` spans multiple lines and it's more difficult to spot the second argument when it's placed on the same line  as `.bind(...)`.


================
Comment at: test/clang-tidy/cert-dcl21-cpp.cpp:1
+// RUN: %check_clang_tidy %s cert-dcl21-cpp %t
+
----------------
As usual, please add tests with macros and templates with multiple instantiations. When diagnostics in macros are ignored, the tests should demonstrate this as well.


https://reviews.llvm.org/D32743





More information about the cfe-commits mailing list