1// RUN: %check_clang_tidy %s modernize-use-override %t -- \
2// RUN: -config="{CheckOptions: {modernize-use-override.OverrideSpelling: 'CUSTOM_OVERRIDE',modernize-use-override.FinalSpelling: 'CUSTOM_FINAL'}}"
3
4// As if the macro was not defined.
5//#define CUSTOM_OVERRIDE override
6//#define CUSTOM_FINAL override
7
8struct Base {
9 virtual ~Base() {}
10 virtual void a();
11 virtual void b();
12};
13
14struct SimpleCases : public Base {
15public:
16 virtual ~SimpleCases();
17 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override]
18 // CHECK-FIXES: {{^}} virtual ~SimpleCases();
19
20 void a();
21 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' [modernize-use-override]
22 // CHECK-FIXES: {{^}} void a();
23
24 virtual void b();
25 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override]
26 // CHECK-FIXES: {{^}} virtual void b();
27};
28

source code of clang-tools-extra/test/clang-tidy/checkers/modernize/use-override-with-no-macro-inscope.cpp