[PATCH] D111041: [clang-tidy] Remove 'IgnoreDestructors = true' from cppcoreguidelines-explicit-virtual-functions

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 11 12:04:58 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-use-override.cpp:56
   virtual ~SimpleCases();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual'
   // CHECK-FIXES: {{^}}  ~SimpleCases() override;
----------------
This isn't quite what I was after; now it looks like we expect to always get the diagnostic (in fact, I'm a bit worried that this test is passing). I'd rather see:
```
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
// CHECK-CPPCOREGUIDELINES-NOT: :[[@LINE-2]]:11: warning: prefer using 'override' or (rarely) 'final' instead of 'virtual'
```
So that we check explicitly we see the diagnostic for modernize and explicitly that we don't see the diagnostic for C++ Core Guidelines.

You'll need to change the second RUN line to not use `check_clang_tidy` but instead execute clang-tidy manually so you can pass `-check-prefix=CHECK-CPPCOREGUIDELINES` to it (as done in https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/cert-static-object-exception.cpp#L4).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111041/new/

https://reviews.llvm.org/D111041



More information about the llvm-commits mailing list