Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/modernize/use-nodiscard-no-macro.cpp

raw
1 // RUN: %check_clang_tidy -std=c++17-or-later %s modernize-use-nodiscard %t
2
3 class Foo
4 {
5 public:
6 bool f1() const;
7 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f1' should be marked {{\[\[nodiscard\]\]}} [modernize-use-nodiscard]
8 // CHECK-FIXES: {{\[\[nodiscard\]\]}} bool f1() const;
9
10 bool f2(int) const;
11 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f2' should be marked {{\[\[nodiscard\]\]}} [modernize-use-nodiscard]
12 // CHECK-FIXES: {{\[\[nodiscard\]\]}} bool f2(int) const;
13
14 bool f3(const int &) const;
15 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f3' should be marked {{\[\[nodiscard\]\]}} [modernize-use-nodiscard]
16 // CHECK-FIXES: {{\[\[nodiscard\]\]}} bool f3(const int &) const;
17
18 bool f4(void) const;
19 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f4' should be marked {{\[\[nodiscard\]\]}} [modernize-use-nodiscard]
20 // CHECK-FIXES: {{\[\[nodiscard\]\]}} bool f4(void) const;
21
22 };