| 1 |
// RUN: %check_clang_tidy %s modernize-use-nodiscard %t -- \ |
| 2 |
// RUN: -config="{CheckOptions: {modernize-use-nodiscard.ReplacementString: '__attribute__((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 __attribute__((warn_unused_result)) [modernize-use-nodiscard] |
| 9 |
// CHECK-FIXES: __attribute__((warn_unused_result)) bool f1() const; |
| 10 |
|
| 11 |
bool f2(int) const; |
| 12 |
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f2' should be marked __attribute__((warn_unused_result)) [modernize-use-nodiscard] |
| 13 |
// CHECK-FIXES: __attribute__((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 __attribute__((warn_unused_result)) [modernize-use-nodiscard] |
| 17 |
// CHECK-FIXES: __attribute__((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 __attribute__((warn_unused_result)) [modernize-use-nodiscard] |
| 21 |
// CHECK-FIXES: __attribute__((warn_unused_result)) bool f4(void) const; |
| 22 |
}; |
| 23 |
|