24 lines · cpp
1// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t -- \2// RUN: -config="{CheckOptions: {readability-redundant-smartptr-get.IgnoreMacros: false}}"3 4namespace std {5 6template <typename T>7struct shared_ptr {8 T &operator*() const;9 T *operator->() const;10 T *get() const;11 explicit operator bool() const noexcept;12};13 14} // namespace std15 16#define MACRO(p) p.get()17 18void Positive() {19 std::shared_ptr<int> x;20 if (MACRO(x) == nullptr)21 ;22 // CHECK-MESSAGES: :[[@LINE-2]]:13: warning: redundant get() call on smart pointer23};24