summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/checkers/readability-redundant-smartptr-get-macros.cpp
blob: 91af3fcec61f404afec0111741cc1106bc58399c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t -- \
// RUN:   -config="{CheckOptions: [{key: readability-redundant-smartptr-get.IgnoreMacros, value: 0}]}"

namespace std {

template <typename T>
struct shared_ptr {
  T &operator*() const;
  T *operator->() const;
  T *get() const;
  explicit operator bool() const noexcept;
};

} // namespace std

#define MACRO(p) p.get()

void Positive() {
  std::shared_ptr<int> x;
  if (MACRO(x) == nullptr)
    ;
  // CHECK-MESSAGES: :[[@LINE-2]]:13: warning: redundant get() call on smart pointer
};
OpenPOWER on IntegriCloud