• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t -- \
2 // RUN:   -config="{CheckOptions: [{key: readability-redundant-smartptr-get.IgnoreMacros, value: 0}]}"
3 
4 namespace std {
5 
6 template <typename T>
7 struct shared_ptr {
8   T &operator*() const;
9   T *operator->() const;
10   T *get() const;
11   explicit operator bool() const noexcept;
12 };
13 
14 } // namespace std
15 
16 #define MACRO(p) p.get()
17 
Positive()18 void 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 pointer
23 };
24