1 // RUN: %check_clang_tidy %s modernize-use-override %t -- \ 2 // RUN: -config="{CheckOptions: [{key: modernize-use-override.OverrideSpelling, value: 'CUSTOM_OVERRIDE'},{key: modernize-use-override.FinalSpelling, value: 'CUSTOM_FINAL'}]}" 3 4 // As if the macro was not defined. 5 //#define CUSTOM_OVERRIDE override 6 //#define CUSTOM_FINAL override 7 8 struct Base { ~BaseBase9 virtual ~Base() {} 10 virtual void a(); 11 virtual void b(); 12 }; 13 14 struct SimpleCases : public Base { 15 public: 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