1 // RUN: %check_clang_tidy %s modernize-use-nodiscard %t -- \ 2 // RUN: -config="{CheckOptions: [{key: modernize-use-nodiscard.ReplacementString, value: '[[clang::warn_unused_result]]'}]}" 3 4 class Foo 5 { 6 public: 7 bool f1() const; 8 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f1' should be marked {{\[\[clang::warn_unused_result\]\]}} [modernize-use-nodiscard] 9 // CHECK-FIXES: {{\[\[clang::warn_unused_result\]\]}} bool f1() const; 10 11 bool f2(int) const; 12 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f2' should be marked {{\[\[clang::warn_unused_result\]\]}} [modernize-use-nodiscard] 13 // CHECK-FIXES: {{\[\[clang::warn_unused_result\]\]}} bool f2(int) const; 14 15 bool f3(const int &) const; 16 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f3' should be marked {{\[\[clang::warn_unused_result\]\]}} [modernize-use-nodiscard] 17 // CHECK-FIXES: {{\[\[clang::warn_unused_result\]\]}} bool f3(const int &) const; 18 19 bool f4(void) const; 20 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f4' should be marked {{\[\[clang::warn_unused_result\]\]}} [modernize-use-nodiscard] 21 // CHECK-FIXES: {{\[\[clang::warn_unused_result\]\]}} bool f4(void) const; 22 23 }; 24 25