https://github.com/vbvictor updated 
https://github.com/llvm/llvm-project/pull/186669

>From 31f38d5c5689d1a6fdc89432df7ef2a7b6954d60 Mon Sep 17 00:00:00 2001
From: Victor Baranov <[email protected]>
Date: Sun, 15 Mar 2026 16:43:26 +0300
Subject: [PATCH 1/2] [clang-tidy][NFC] Use universal containers mock

---
 .../checkers/Inputs/Headers/std/deque         |  71 ++++
 .../checkers/Inputs/Headers/std/forward_list  |  61 ++++
 .../checkers/Inputs/Headers/std/functional    |  82 +++++
 .../checkers/Inputs/Headers/std/list          |  68 ++++
 .../checkers/Inputs/Headers/std/map           | 127 +++++++
 .../checkers/Inputs/Headers/std/queue         |  45 +++
 .../checkers/Inputs/Headers/std/set           | 121 +++++++
 .../checkers/Inputs/Headers/std/stack         |  28 ++
 .../checkers/Inputs/Headers/std/string        |   1 +
 .../checkers/Inputs/Headers/std/tuple         |  81 +++++
 .../checkers/Inputs/Headers/std/unordered_map | 126 +++++++
 .../checkers/Inputs/Headers/std/unordered_set | 113 +++++++
 .../checkers/Inputs/Headers/std/utility       |  28 ++
 .../checkers/Inputs/Headers/std/vector        |   6 +-
 .../checkers/bugprone/dangling-handle.cpp     |  30 +-
 .../checkers/bugprone/infinite-loop.cpp       |  37 +-
 .../checkers/bugprone/unsafe-functions.cpp    |  10 +-
 .../checkers/bugprone/use-after-move.cpp      |  69 +---
 .../pro-bounds-pointer-arithmetic.cpp         |   8 +-
 .../checkers/fuchsia/trailing-return.cpp      |  10 +-
 .../google/build-explicit-make-pair.cpp       |  12 +-
 .../fake_std_pair_tuple.h                     |  62 ----
 .../checkers/modernize/use-emplace.cpp        | 318 +-----------------
 .../modernize/use-structured-binding.cpp      |  25 +-
 .../modernize/use-transparent-functors.cpp    |  39 +--
 .../portability/std-allocator-const.cpp       |  40 +--
 .../readability/container-contains.cpp        |  39 +--
 .../readability/isolate-declaration-cxx17.cpp |  18 +-
 28 files changed, 1028 insertions(+), 647 deletions(-)
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/deque
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/forward_list
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/functional
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/list
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/map
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/queue
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/set
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/stack
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_map
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_set
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-structured-binding/fake_std_pair_tuple.h

diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/deque 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/deque
new file mode 100644
index 0000000000000..9f7393b467321
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/deque
@@ -0,0 +1,71 @@
+#ifndef _DEQUE_
+#define _DEQUE_
+
+#include <initializer_list>
+#include <memory>
+
+namespace std {
+
+template <typename T, typename Allocator = allocator<T>>
+class deque {
+public:
+  using value_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    T &operator*();
+    T *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class reverse_iterator {};
+
+  deque() = default;
+  deque(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  void push_front(const T &) {}
+  void push_front(T &&) {}
+
+  template <typename... Args>
+  iterator emplace(const_iterator pos, Args &&...args);
+  template <typename... Args>
+  void emplace_back(Args &&...args) {}
+  template <typename... Args>
+  void emplace_front(Args &&...args) {}
+
+  T &operator[](size_t);
+  const T &operator[](size_t) const;
+
+  void assign(size_t count, const T &value);
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+
+  ~deque();
+};
+
+} // namespace std
+
+#endif // _DEQUE_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/forward_list 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/forward_list
new file mode 100644
index 0000000000000..b2a6521c0d331
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/forward_list
@@ -0,0 +1,61 @@
+#ifndef _FORWARD_LIST_
+#define _FORWARD_LIST_
+
+#include <initializer_list>
+#include <memory>
+
+namespace std {
+
+template <typename T, typename Allocator = allocator<T>>
+class forward_list {
+public:
+  using value_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    T &operator*();
+    T *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+
+  forward_list() = default;
+  forward_list(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  void push_front(const T &) {}
+  void push_front(T &&) {}
+
+  template <typename... Args>
+  void emplace_front(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_after(const_iterator pos, Args &&...args);
+
+  void assign(size_t count, const T &value);
+
+  void clear();
+  bool empty() const;
+
+  ~forward_list();
+};
+
+} // namespace std
+
+#endif // _FORWARD_LIST_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/functional 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/functional
new file mode 100644
index 0000000000000..0f524c9c85508
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/functional
@@ -0,0 +1,82 @@
+#ifndef _FUNCTIONAL_
+#define _FUNCTIONAL_
+
+namespace std {
+
+template <typename T = void>
+struct less {
+  constexpr bool operator()(const T &Lhs, const T &Rhs) const {
+    return Lhs < Rhs;
+  }
+};
+
+template <>
+struct less<void> {
+  template <typename T, typename U>
+  constexpr bool operator()(T &&Lhs, U &&Rhs) const {
+    return Lhs < Rhs;
+  }
+};
+
+template <typename T = void>
+struct greater {
+  constexpr bool operator()(const T &Lhs, const T &Rhs) const {
+    return Lhs > Rhs;
+  }
+};
+
+template <>
+struct greater<void> {
+  template <typename T, typename U>
+  constexpr bool operator()(T &&Lhs, U &&Rhs) const {
+    return Lhs > Rhs;
+  }
+};
+
+template <typename T = void>
+struct equal_to {
+  constexpr bool operator()(const T &Lhs, const T &Rhs) const {
+    return Lhs == Rhs;
+  }
+};
+
+template <>
+struct equal_to<void> {
+  template <typename T, typename U>
+  constexpr bool operator()(T &&Lhs, U &&Rhs) const {
+    return Lhs == Rhs;
+  }
+};
+
+template <typename T>
+struct hash {};
+
+template <typename T = void>
+struct plus {
+  constexpr T operator()(const T &Lhs, const T &Rhs) const {
+    return Lhs + Rhs;
+  }
+};
+
+template <>
+struct plus<void> {
+  template <typename T, typename U>
+  constexpr auto operator()(T &&Lhs, U &&Rhs) const -> decltype(Lhs + Rhs) {
+    return Lhs + Rhs;
+  }
+};
+
+template <typename T = void>
+struct logical_not {
+  constexpr bool operator()(const T &Arg) const { return !Arg; }
+};
+
+template <>
+struct logical_not<void> {
+  template <typename T>
+  constexpr bool operator()(T &&Arg) const { return !Arg; }
+};
+
+} // namespace std
+
+#endif // _FUNCTIONAL_
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/list 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/list
new file mode 100644
index 0000000000000..a5ea99180869a
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/list
@@ -0,0 +1,68 @@
+#ifndef _LIST_
+#define _LIST_
+
+#include <initializer_list>
+#include <memory>
+
+namespace std {
+
+template <typename T, typename Allocator = allocator<T>>
+class list {
+public:
+  using value_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    T &operator*();
+    T *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class reverse_iterator {};
+
+  list() = default;
+  list(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  void push_front(const T &) {}
+  void push_front(T &&) {}
+
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template <typename... Args>
+  iterator emplace(const_iterator pos, Args &&...args);
+  template <typename... Args>
+  void emplace_back(Args &&...args) {}
+  template <typename... Args>
+  void emplace_front(Args &&...args) {}
+
+  void assign(size_t count, const T &value);
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+
+  ~list();
+};
+
+} // namespace std
+
+#endif // _LIST_
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/map 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/map
new file mode 100644
index 0000000000000..63b10cac05190
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/map
@@ -0,0 +1,127 @@
+#ifndef _MAP_
+#define _MAP_
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+#include <utility>
+
+namespace std {
+
+template <typename Key, typename T, typename Compare = less<Key>,
+          typename Allocator = allocator<pair<const Key, T>>>
+class map {
+public:
+  using key_type = Key;
+  using mapped_type = T;
+  using value_type = std::pair<const Key, T>;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    value_type &operator*();
+    value_type *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator(decltype(nullptr)) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const value_type &operator*() const;
+    const value_type *operator->() const;
+  };
+
+  map() = default;
+  map(initializer_list<value_type>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  T &operator[](const Key &);
+  T &operator[](Key &&);
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  template <typename... Args>
+  pair<iterator, bool> try_emplace(const Key &key, Args &&...args);
+
+  iterator find(const Key &);
+  const_iterator find(const Key &) const;
+
+  T &at(const Key &);
+  const T &at(const Key &) const;
+
+  unsigned count(const Key &) const;
+  bool contains(const Key &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+template <typename Key, typename T, typename Compare = less<Key>,
+          typename Allocator = allocator<pair<const Key, T>>>
+class multimap {
+public:
+  using key_type = Key;
+  using mapped_type = T;
+  using value_type = std::pair<const Key, T>;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    value_type &operator*();
+    value_type *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator(decltype(nullptr)) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const value_type &operator*() const;
+    const value_type *operator->() const;
+  };
+
+  multimap() = default;
+  multimap(initializer_list<value_type>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  unsigned count(const Key &) const;
+  bool contains(const Key &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _MAP_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/queue 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/queue
new file mode 100644
index 0000000000000..99ae5ff1c1ed1
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/queue
@@ -0,0 +1,45 @@
+#ifndef _QUEUE_
+#define _QUEUE_
+
+namespace std {
+
+template <typename T, typename Container = void>
+class queue {
+public:
+  using value_type = T;
+
+  void push(const T &) {}
+  void push(T &&) {}
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+
+  T &front();
+  const T &front() const;
+  T &back();
+  const T &back() const;
+
+  bool empty() const;
+  size_t size() const;
+};
+
+template <typename T, typename Container = void, typename Compare = void>
+class priority_queue {
+public:
+  using value_type = T;
+
+  void push(const T &) {}
+  void push(T &&) {}
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+
+  const T &top() const;
+
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _QUEUE_
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/set 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/set
new file mode 100644
index 0000000000000..39448431da032
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/set
@@ -0,0 +1,121 @@
+#ifndef _SET_
+#define _SET_
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+#include <utility>
+
+namespace std {
+
+template <typename T, typename Compare = less<T>,
+          typename Allocator = allocator<T>>
+class set {
+public:
+  using value_type = T;
+  using key_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator(decltype(nullptr)) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+
+  set() = default;
+  set(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  pair<iterator, bool> insert(const T &);
+  pair<iterator, bool> insert(T &&);
+  iterator insert(const_iterator hint, const T &);
+  iterator insert(const_iterator hint, T &&);
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  iterator find(const T &);
+  const_iterator find(const T &) const;
+
+  unsigned count(const T &) const;
+  bool contains(const T &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+template <typename T, typename Compare = less<T>,
+          typename Allocator = allocator<T>>
+class multiset {
+public:
+  using value_type = T;
+  using key_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator(decltype(nullptr)) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+
+  multiset() = default;
+  multiset(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  unsigned count(const T &) const;
+  bool contains(const T &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _SET_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/stack 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/stack
new file mode 100644
index 0000000000000..a5edaed7eb152
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/stack
@@ -0,0 +1,28 @@
+#ifndef _STACK_
+#define _STACK_
+
+#include <deque>
+
+namespace std {
+
+template <typename T, typename Container = deque<T>>
+class stack {
+public:
+  using value_type = T;
+
+  void push(const T &) {}
+  void push(T &&) {}
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+
+  T &top();
+  const T &top() const;
+
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _STACK_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/string 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/string
index 3631c0330c427..dbebeaaa46514 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/string
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/string
@@ -33,6 +33,7 @@ struct basic_string {
   const C *c_str() const;
   const C *data() const;
 
+  void clear();
   bool empty() const;
   size_type size() const;
   size_type length() const;
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
new file mode 100644
index 0000000000000..1424b95b09355
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
@@ -0,0 +1,81 @@
+#ifndef _TUPLE_
+#define _TUPLE_
+
+#include <utility>
+
+namespace std {
+
+template <typename T, T V>
+struct integral_constant {
+  static constexpr T value = V;
+};
+
+struct _Swallow_assign
+{
+  template<class _Tp>
+      const _Swallow_assign&
+    operator=(const _Tp&) const
+    { return *this; }
+};
+
+constexpr _Swallow_assign ignore{};
+
+template <typename... Ts>
+class tuple {
+public:
+  tuple() = default;
+  tuple(const tuple &) = default;
+  tuple(tuple &&) = default;
+  tuple &operator=(const tuple &) = default;
+  tuple &operator=(tuple &&) = default;
+
+  tuple(const Ts &...) {}
+  tuple(Ts &&...) {}
+
+  template <typename... Us>
+  tuple(const tuple<Us...> &) {}
+  template <typename... Us>
+  tuple(tuple<Us...> &&) {}
+
+  template <typename U1, typename U2>
+  tuple(const pair<U1, U2> &) {}
+  template <typename U1, typename U2>
+  tuple(pair<U1, U2> &&) {}
+};
+
+template <typename T>
+struct tuple_size;
+
+template <typename... Ts>
+struct tuple_size<tuple<Ts...>>
+    : integral_constant<size_t, sizeof...(Ts)> {};
+
+template <size_t I, typename T>
+struct tuple_element;
+
+template <size_t I, typename... Ts>
+struct tuple_element<I, tuple<Ts...>> {
+  using type = __type_pack_element<I, Ts...>;
+};
+
+template <size_t I, typename... Ts>
+typename tuple_element<I, tuple<Ts...>>::type
+get(const tuple<Ts...> &);
+
+template <size_t I, typename... Ts>
+typename tuple_element<I, tuple<Ts...>>::type
+get(tuple<Ts...> &&);
+
+template <typename... Ts>
+tuple<typename remove_reference<Ts>::type...> make_tuple(Ts &&...) {
+  return {};
+}
+
+template<typename... Args>
+tuple<Args...> tie(Args&... args) {
+  return tuple<Args...>(args...);
+}
+
+} // namespace std
+
+#endif // _TUPLE_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_map 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_map
new file mode 100644
index 0000000000000..509fdaa96849a
--- /dev/null
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_map
@@ -0,0 +1,126 @@
+#ifndef _UNORDERED_MAP_
+#define _UNORDERED_MAP_
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+#include <utility>
+
+namespace std {
+
+template <typename Key, typename T, typename Hash = hash<Key>,
+          typename Pred = equal_to<Key>,
+          typename Allocator = allocator<pair<const Key, T>>>
+class unordered_map {
+public:
+  using key_type = Key;
+  using mapped_type = T;
+  using value_type = std::pair<const Key, T>;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    value_type &operator*();
+    value_type *operator->();
+    const value_type &operator*() const;
+    const value_type *operator->() const;
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const value_type &operator*() const;
+    const value_type *operator->() const;
+  };
+
+  unordered_map() = default;
+  unordered_map(initializer_list<value_type>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  T &operator[](const Key &);
+  T &operator[](Key &&);
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  template <typename... Args>
+  pair<iterator, bool> try_emplace(const Key &key, Args &&...args);
+
+  iterator find(const Key &);
+  const_iterator find(const Key &) const;
+
+  unsigned count(const Key &) const;
+  bool contains(const Key &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+template <typename Key, typename T, typename Hash = hash<Key>,
+          typename Pred = equal_to<Key>,
+          typename Allocator = allocator<pair<const Key, T>>>
+class unordered_multimap {
+public:
+  using key_type = Key;
+  using mapped_type = T;
+  using value_type = std::pair<const Key, T>;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    value_type &operator*();
+    value_type *operator->();
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const value_type &operator*() const;
+    const value_type *operator->() const;
+  };
+
+  unordered_multimap() = default;
+  unordered_multimap(initializer_list<value_type>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  unsigned count(const Key &) const;
+  bool contains(const Key &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _UNORDERED_MAP_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_set 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_set
new file mode 100644
index 0000000000000..f07fbea587088
--- /dev/null
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/unordered_set
@@ -0,0 +1,113 @@
+#ifndef _UNORDERED_SET_
+#define _UNORDERED_SET_
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+
+namespace std {
+
+template <typename T, typename Hash = hash<T>, typename Pred = equal_to<T>,
+          typename Allocator = allocator<T>>
+class unordered_set {
+public:
+  using value_type = T;
+  using key_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+
+  unordered_set() = default;
+  unordered_set(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  iterator find(const T &);
+  const_iterator find(const T &) const;
+
+  unsigned count(const T &) const;
+  bool contains(const T &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+template <typename T, typename Hash = hash<T>, typename Pred = equal_to<T>,
+          typename Allocator = allocator<T>>
+class unordered_multiset {
+public:
+  using value_type = T;
+  using key_type = T;
+
+  class iterator {
+  public:
+    iterator &operator++();
+    iterator operator++(int);
+    bool operator!=(const iterator &other) const;
+    bool operator==(const iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+  class const_iterator {
+  public:
+    const_iterator() = default;
+    const_iterator(const iterator &) {}
+    const_iterator &operator++();
+    const_iterator operator++(int);
+    bool operator!=(const const_iterator &other) const;
+    bool operator==(const const_iterator &other) const;
+    const T &operator*() const;
+    const T *operator->() const;
+  };
+
+  unordered_multiset() = default;
+  unordered_multiset(initializer_list<T>) {}
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+
+  template <typename... Args>
+  void emplace(Args &&...args) {}
+  template <typename... Args>
+  iterator emplace_hint(const_iterator pos, Args &&...args);
+
+  unsigned count(const T &) const;
+  bool contains(const T &) const;
+
+  void clear();
+  bool empty() const;
+  size_t size() const;
+};
+
+} // namespace std
+
+#endif // _UNORDERED_SET_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/utility 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/utility
index deca0c71e2edf..4c72e941dc825 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/utility
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/utility
@@ -27,6 +27,34 @@ void swap(T &a, T &b) {
   b = move(tmp);
 }
 
+template <typename T1, typename T2>
+struct pair {
+  T1 first;
+  T2 second;
+
+  pair() = default;
+  pair(const pair &) = default;
+  pair(pair &&) = default;
+
+  pair(const T1 &a, const T2 &b) : first(a), second(b) {}
+  pair(T1 &&a, T2 &&b)
+      : first(std::move(a)), second(std::move(b)) {}
+
+  template <typename U1, typename U2>
+  pair(const pair<U1, U2> &p) : first(p.first), second(p.second) {}
+  template <typename U1, typename U2>
+  pair(pair<U1, U2> &&p)
+      : first(std::move(p.first)), second(std::move(p.second)) {}
+
+  pair &operator=(const pair &) = default;
+  pair &operator=(pair &&) = default;
+};
+
+template <typename T1, typename T2>
+pair<T1, T2> make_pair(T1 x, T2 y) {
+  return pair<T1, T2>(x, y);
+}
+
 } // namespace std
 
 #endif // _UTILITY_
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/vector 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/vector
index 32eebb9387172..e7d85f9ecce91 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/vector
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/vector
@@ -28,11 +28,11 @@ public:
   vector &operator=(vector &&other);
   vector &operator=(initializer_list<T>);
 
-  void push_back(const T &value);
-  void push_back(T &&value);
+  void push_back(const T &value) {}
+  void push_back(T &&value) {}
 
   template <typename... Args>
-  void emplace_back(Args &&...args);
+  void emplace_back(Args &&...args) {}
 
   template <typename... Args>
   iterator emplace(const_iterator pos, Args &&...args);
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp
index 2467b3383b44a..3857f2b023d6b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp
@@ -6,36 +6,12 @@
 // RUN:   -config="{CheckOptions: \
 // RUN:             {bugprone-dangling-handle.HandleClasses: \
 // RUN:               'std::basic_string_view; ::llvm::StringRef;'}}"
+#include <map>
+#include <set>
 #include <string>
+#include <utility>
 #include <vector>
 
-namespace std {
-
-template <typename, typename>
-class pair {};
-
-template <typename T>
-class set {
- public:
-  using const_iterator = const T*;
-  using iterator = T*;
-
-  std::pair<iterator, bool> insert(const T& value);
-  std::pair<iterator, bool> insert(T&& value);
-  iterator insert(const_iterator hint, const T& value);
-  iterator insert(const_iterator hint, T&& value);
-};
-
-template <typename Key, typename Value>
-class map {
- public:
-  using value_type = pair<Key, Value>;
-  value_type& operator[](const Key& key);
-  value_type& operator[](Key&& key);
-};
-
-}  // namespace std
-
 namespace llvm {
 
 class StringRef {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/infinite-loop.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/infinite-loop.cpp
index 9a58a7ae2f2ab..b0e68ed1e8b06 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/infinite-loop.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/infinite-loop.cpp
@@ -1,6 +1,8 @@
 // RUN: %check_clang_tidy %s bugprone-infinite-loop %t \
 // RUN:                   -- -- -fexceptions -fblocks 
-fno-delayed-template-parsing
 
+#include <tuple>
+
 void simple_infinite_loop1() {
   int i = 0;
   int j = 0;
@@ -793,16 +795,6 @@ void issue_138842_reduced() {
     }
 }
 
-namespace std {
-template <typename T, typename U>
-struct pair {
-  T first;
-  U second;
-
-  pair(T a, U b) : first(a), second(b) {}
-};
-}
-
 template <typename T, typename U>
 void structured_binding_in_template_byval(T a, U b) {
   auto [c, d] = std::pair<T, U>(a,b);
@@ -867,31 +859,6 @@ void array_structured_binding() {
   }
 }
 
-namespace std {
-    using size_t = int;
-    template <class> struct tuple_size;
-    template <std::size_t, class> struct tuple_element;
-    template <class...> class tuple;
-
-namespace {
-    template <class T, T v>
-    struct size_helper { static const T value = v; };
-} // namespace
-
-template <class... T>
-struct tuple_size<tuple<T...>> : size_helper<std::size_t, sizeof...(T)> {};
-
-template <std::size_t I, class... T>
-struct tuple_element<I, tuple<T...>> {
-    using type =  __type_pack_element<I, T...>;
-};
-
-template <class...> class tuple {};
-
-template <std::size_t I, class... T>
-typename tuple_element<I, tuple<T...>>::type get(tuple<T...>);
-} // namespace std
-
 std::tuple<int*, int> &get_chunk();
 
 void test_structured_bindings_tuple() {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
index 1ff04ed002a92..07a9855858535 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
@@ -1,12 +1,8 @@
-// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-unsafe-functions %t 
--
+// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-unsafe-functions %t
 
-namespace std {
-template <class T1, class T2>
-struct pair {
-  T1 first;
-  T2 second;
-};
+#include <utility>
 
+namespace std {
 using ptrdiff_t = long long;
 
 template<class T>
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move.cpp
index 5d95c44fc318f..c4edd999b7824 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move.cpp
@@ -11,8 +11,17 @@
 // RUN:   }}' -- \
 // RUN:   -fno-delayed-template-parsing
 
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <map>
+#include <set>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
 #include <utility>
 #include <memory>
+#include <vector>
 
 typedef decltype(nullptr) nullptr_t;
 
@@ -31,62 +40,6 @@ struct any {
   void reset();
 };
 
-template <typename T1, typename T2>
-struct pair {};
-
-template <typename Key, typename T>
-struct map {
-  struct iterator {};
-
-  map();
-  void clear();
-  bool empty();
-  template <class... Args>
-  pair<iterator, bool> try_emplace(const Key &key, Args &&...args);
-};
-
-template <typename Key, typename T>
-struct unordered_map {
-  struct iterator {};
-
-  unordered_map();
-  void clear();
-  bool empty();
-  template <class... Args>
-  pair<iterator, bool> try_emplace(const Key &key, Args &&...args);
-};
-
-#define DECLARE_STANDARD_CONTAINER(name) \
-  template <typename T>                  \
-  struct name {                          \
-    name();                              \
-    void clear();                        \
-    bool empty();                        \
-  }
-
-#define DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(name) \
-  template <typename T>                              \
-  struct name {                                      \
-    name();                                          \
-    void clear();                                    \
-    bool empty();                                    \
-    void assign(size_t, const T &);                  \
-  }
-
-DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(basic_string);
-DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(vector);
-DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(deque);
-DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(forward_list);
-DECLARE_STANDARD_CONTAINER_WITH_ASSIGN(list);
-DECLARE_STANDARD_CONTAINER(set);
-DECLARE_STANDARD_CONTAINER(multiset);
-DECLARE_STANDARD_CONTAINER(multimap);
-DECLARE_STANDARD_CONTAINER(unordered_set);
-DECLARE_STANDARD_CONTAINER(unordered_multiset);
-DECLARE_STANDARD_CONTAINER(unordered_multimap);
-
-typedef basic_string<char> string;
-
 } // namespace std
 
 class A {
@@ -851,7 +804,7 @@ void standardContainerClearIsReinit() {
     container.empty();
   }
   {
-    std::multimap<int> container;
+    std::multimap<int, int> container;
     std::move(container);
     container.clear();
     container.empty();
@@ -875,7 +828,7 @@ void standardContainerClearIsReinit() {
     container.empty();
   }
   {
-    std::unordered_multimap<int> container;
+    std::unordered_multimap<int, int> container;
     std::move(container);
     container.clear();
     container.empty();
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
index fa81c135a1803..6c409c6b83452 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
@@ -1,6 +1,8 @@
 // RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-pointer-arithmetic 
-check-suffixes=,DEFAULT  %t
 // RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-pointer-arithmetic 
%t -- \
-// RUN:   -config="{CheckOptions: 
{cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators:
 true}}" --
+// RUN:   -config="{CheckOptions: 
{cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators:
 true}}"
+
+#include <utility>
 
 enum E {
   ENUM_LITERAL = 1
@@ -122,13 +124,11 @@ void okay() {
 namespace gh126424 {
 
 namespace std {
-template <typename, typename>
-class pair {};
 
 template <typename Key, typename Value>
 class map {
   public:
-   using value_type = pair<Key, Value>;
+   using value_type = ::std::pair<Key, Value>;
    value_type& operator[](const Key& key);
    value_type& operator[](Key&& key);
  };
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/trailing-return.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/trailing-return.cpp
index 14c4452e4fdc2..f63e5f27d6ecf 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/trailing-return.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/trailing-return.cpp
@@ -1,5 +1,7 @@
 // RUN: %check_clang_tidy -std=c++17-or-later %s fuchsia-trailing-return %t
 
+#include <utility>
+
 int add_one(const int arg) { return arg; }
 
 auto get_add_one() -> int (*)(const int) {
@@ -29,12 +31,6 @@ struct ImplicitDeductionGuides {
   ImplicitDeductionGuides(const T &);
 };
 
-template <typename A, typename B>
-struct pair {
-  A first;
-  B second;
-};
-
 template <typename T>
 struct UserDefinedDeductionGuides {
   UserDefinedDeductionGuides(T);
@@ -43,7 +39,7 @@ struct UserDefinedDeductionGuides {
 };
 
 template <typename T1, typename T2>
-UserDefinedDeductionGuides(T1, T2) -> UserDefinedDeductionGuides<pair<T1, T2>>;
+UserDefinedDeductionGuides(T1, T2) -> UserDefinedDeductionGuides<std::pair<T1, 
T2>>;
 
 void foo() {
   ImplicitDeductionGuides X(42);
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/google/build-explicit-make-pair.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/google/build-explicit-make-pair.cpp
index ea77272f97761..c2d47e67e6e28 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/google/build-explicit-make-pair.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/google/build-explicit-make-pair.cpp
@@ -1,16 +1,6 @@
 // RUN: %check_clang_tidy %s google-build-explicit-make-pair %t
 
-namespace std {
-template <class T1, class T2>
-struct pair {
-  pair(T1 x, T2 y) {}
-};
-
-template <class T1, class T2>
-pair<T1, T2> make_pair(T1 x, T2 y) {
-  return pair<T1, T2>(x, y);
-}
-}
+#include <utility>
 
 template <typename T>
 void templ(T a, T b) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-structured-binding/fake_std_pair_tuple.h
 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-structured-binding/fake_std_pair_tuple.h
deleted file mode 100644
index 2f8ce2b157e3f..0000000000000
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-structured-binding/fake_std_pair_tuple.h
+++ /dev/null
@@ -1,62 +0,0 @@
-namespace std {
-  struct _Swallow_assign
-  {
-    template<class _Tp>
-       const _Swallow_assign&
-      operator=(const _Tp&) const
-      { return *this; }
-  };
-
-  constexpr _Swallow_assign ignore{};
-
-  template<typename T1, typename T2>
-  struct pair {
-    T1 first;
-    T2 second;
-
-    pair() = default;
-    pair(T1 first, T2 second) : first(first), second(second) {}
-  };
-
-  template<typename... Args>
-  struct tuple {
-    tuple(Args&...) {}
-
-    template<typename T1, typename T2>
-    tuple<T1, T2> operator=(const std::pair<T1, T2>&);
-  };
-
-  template<typename... Args>
-  tuple<Args...> tie(Args&... args) {
-    return tuple<Args...>(args...);
-  }
-
-  template <typename Key, typename Value>
-  class unordered_map {
-  public:
-    using value_type = pair<Key, Value>;
-
-    class iterator {
-    public:
-      iterator& operator++();
-      bool operator!=(const iterator &other);
-      const value_type &operator*() const;
-      value_type operator*();
-      const value_type* operator->() const;
-    };
-
-    iterator begin() const;
-    iterator end() const;
-  };
-}
-
-template<typename T1, typename T2>
-std::pair<T1, T2> getPair();
-
-template<typename T1, typename T2>
-constexpr std::pair<T1, T2> getConstexprPair() {
-  return std::pair<T1, T2>();
-}
-
-template<typename T1, typename T2, typename T3>
-std::tuple<T1, T2, T3> getTuple();
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
index bed5c88ed47d8..a2ab19efcf698 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
@@ -7,314 +7,20 @@
 // RUN:              modernize-use-emplace.TupleMakeFunctions: \
 // RUN:                '::std::make_pair; ::std::make_tuple; 
::test::MakeSingle'}}"
 
+#include <tuple>
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <map>
+#include <queue>
+#include <set>
+#include <stack>
+#include <tuple>
+#include <unordered_map>
+#include <unordered_set>
 #include <utility>
 #include <memory>
-
-namespace std {
-template <typename E>
-class initializer_list {
-public:
-  const E *a, *b;
-  initializer_list() noexcept {}
-};
-
-template <typename T1, typename T2>
-class pair {
-public:
-  pair() = default;
-  pair(const pair &) = default;
-  pair(pair &&) = default;
-
-  pair(const T1 &, const T2 &) {}
-  pair(T1 &&, T2 &&) {}
-
-  template <typename U1, typename U2>
-  pair(const pair<U1, U2> &){};
-  template <typename U1, typename U2>
-  pair(pair<U1, U2> &&){};
-};
-
-template <typename T>
-class vector {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  vector() = default;
-  vector(initializer_list<T>) {}
-
-  void push_back(const T &) {}
-  void push_back(T &&) {}
-
-  template <typename... Args>
-  void emplace_back(Args &&... args){};
-  template <typename... Args>
-  iterator emplace(const_iterator pos, Args &&...args);
-  ~vector();
-};
-
-template <typename T>
-class list {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  void push_front(const T &) {}
-  void push_front(T &&) {}
-
-  void push_back(const T &) {}
-  void push_back(T &&) {}
-
-  template <typename... Args>
-  iterator emplace(const_iterator pos, Args &&...args);
-  template <typename... Args>
-  void emplace_back(Args &&... args){};
-  template <typename... Args>
-  void emplace_front(Args &&...args){};
-  ~list();
-};
-
-template <typename T>
-class deque {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  void push_back(const T &) {}
-  void push_back(T &&) {}
-
-  void push_front(const T &) {}
-  void push_front(T &&) {}
-
-  template <typename... Args>
-  iterator emplace(const_iterator pos, Args &&...args);
-  template <typename... Args>
-  void emplace_back(Args &&... args){};
-  template <typename... Args>
-  void emplace_front(Args &&...args){};
-  ~deque();
-};
-
-template <typename T>
-class forward_list {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  void push_front(const T &) {}
-  void push_front(T &&) {}
-
-  template <typename... Args>
-  void emplace_front(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_after(const_iterator pos, Args &&...args);
-};
-
-template <typename T>
-class set {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename Key, typename T>
-class map {
-public:
-  using value_type = std::pair<Key, T>;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename T>
-class multiset {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename Key, typename T>
-class multimap {
-public:
-  using value_type = std::pair<Key, T>;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename T>
-class unordered_set {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename Key, typename T>
-class unordered_map {
-public:
-  using value_type = std::pair<Key, T>;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename T>
-class unordered_multiset {
-public:
-  using value_type = T;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename Key, typename T>
-class unordered_multimap {
-public:
-  using value_type = std::pair<Key, T>;
-
-  class iterator {};
-  class const_iterator {};
-  const_iterator begin() { return const_iterator{}; }
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-  template <typename... Args>
-  iterator emplace_hint(const_iterator pos, Args &&...args);
-};
-
-template <typename T>
-class stack {
-public:
-  using value_type = T;
-
-  void push(const T &) {}
-  void push(T &&) {}
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-};
-
-template <typename T>
-class queue {
-public:
-  using value_type = T;
-
-  void push(const T &) {}
-  void push(T &&) {}
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-};
-
-template <typename T>
-class priority_queue {
-public:
-  using value_type = T;
-
-  void push(const T &) {}
-  void push(T &&) {}
-
-  template <typename... Args>
-  void emplace(Args &&...args){};
-};
-
-template <typename T1, typename T2>
-pair<typename remove_reference<T1>::type, typename remove_reference<T2>::type>
-make_pair(T1 &&, T2 &&) {
-  return {};
-};
-
-template <typename... Ts>
-class tuple {
-public:
-  tuple() = default;
-  tuple(const tuple &) = default;
-  tuple(tuple &&) = default;
-
-  tuple(const Ts &...) {}
-  tuple(Ts &&...) {}
-
-  template <typename... Us>
-  tuple(const tuple<Us...> &){};
-  template <typename... Us>
-  tuple(tuple<Us...> &&) {}
-
-  template <typename U1, typename U2>
-  tuple(const pair<U1, U2> &) {
-    static_assert(sizeof...(Ts) == 2, "Wrong tuple size");
-  };
-  template <typename U1, typename U2>
-  tuple(pair<U1, U2> &&) {
-    static_assert(sizeof...(Ts) == 2, "Wrong tuple size");
-  };
-};
-
-template <typename... Ts>
-tuple<typename remove_reference<Ts>::type...> make_tuple(Ts &&...) {
-  return {};
-}
-
-} // namespace std
+#include <vector>
 
 namespace llvm {
 template <typename T>
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp
index bbf5c3d582b6a..ac5500dcc6959 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp
@@ -1,6 +1,21 @@
 // RUN: %check_clang_tidy -check-suffix=,CPP20ORLATER -std=c++20-or-later %s 
modernize-use-structured-binding %t -- -- -I %S/Inputs/use-structured-binding/
 // RUN: %check_clang_tidy -std=c++17 %s modernize-use-structured-binding %t -- 
-- -I %S/Inputs/use-structured-binding/
-#include "fake_std_pair_tuple.h"
+
+#include <utility>
+#include <tuple>
+
+#include <unordered_map>
+
+template<typename T1, typename T2>
+std::pair<T1, T2> getPair();
+
+template<typename T1, typename T2>
+constexpr std::pair<T1, T2> getConstexprPair() {
+  return std::pair<T1, T2>();
+}
+
+template<typename T1, typename T2, typename T3>
+std::tuple<T1, T2, T3> getTuple();
 
 template<typename T>
 void MarkUsed(T x);
@@ -665,12 +680,12 @@ void IgnoreDirectInit() {
 }
 
 void StdMapTestCases() {
-  for (auto p : std::unordered_map<int, int>()) {
+  for (const auto p : std::unordered_map<int, int>()) {
     // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a structured binding to 
decompose a pair [modernize-use-structured-binding]
-    // CHECK-FIXES: for (auto [x, y] : std::unordered_map<int, int>()) {
+    // CHECK-FIXES: for (const auto [x, y] : std::unordered_map<int, int>()) {
     // CHECK-NEXT: // REMOVE
-    int x = p.first;
-    int y = p.second; // REMOVE
+    const int x = p.first;
+    const int y = p.second; // REMOVE
     // CHECK-FIXES: // REMOVE
   }
 }
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-transparent-functors.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-transparent-functors.cpp
index 2c7f743acc63d..96149af28d63c 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-transparent-functors.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-transparent-functors.cpp
@@ -1,44 +1,9 @@
 // RUN: %check_clang_tidy -std=c++14-or-later %s 
modernize-use-transparent-functors %t
 
-#include <utility>
+#include <functional>
+#include <memory>
 
 namespace std {
-template <typename T = void>
-struct plus {
-  constexpr T operator()(const T &Lhs, const T &Rhs) const;
-};
-
-template <>
-struct plus<void> {
-  template <typename T, typename U>
-  constexpr auto operator()(T &&Lhs, U &&Rhs) const ->
-    decltype(forward<T>(Lhs) + forward<U>(Rhs));
-};
-
-template <typename T = void>
-struct less {
-  constexpr bool operator()(const T &Lhs, const T &Rhs) const;
-};
-
-template <>
-struct less<void> {
-  template <typename T, typename U>
-  constexpr bool operator()(T &&Lhs, U &&Rhs) const;
-};
-
-template <typename T = void>
-struct logical_not {
-  constexpr bool operator()(const T &Arg) const;
-};
-
-template <>
-struct logical_not<void> {
-  template <typename T>
-  constexpr bool operator()(T &&Arg) const;
-};
-
-template <typename T>
-class allocator;
 
 template <
     class Key,
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/portability/std-allocator-const.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/portability/std-allocator-const.cpp
index a38594aa94cbb..5fe89b67e21c4 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/portability/std-allocator-const.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/portability/std-allocator-const.cpp
@@ -1,38 +1,12 @@
 // RUN: %check_clang_tidy -std=c++11-or-later %s 
portability-std-allocator-const %t -- -- -fno-delayed-template-parsing
 
-namespace std {
-typedef unsigned size_t;
-
-template <class T>
-class allocator {};
-template <class T>
-class hash {};
-template <class T>
-class equal_to {};
-template <class T>
-class less {};
-
-template <class T, class A = std::allocator<T>>
-class deque {};
-template <class T, class A = std::allocator<T>>
-class forward_list {};
-template <class T, class A = std::allocator<T>>
-class list {};
-template <class T, class A = std::allocator<T>>
-class vector {};
-
-template <class K, class C = std::less<K>, class A = std::allocator<K>>
-class multiset {};
-template <class K, class C = std::less<K>, class A = std::allocator<K>>
-class set {};
-template <class K, class H = std::hash<K>, class Eq = std::equal_to<K>, class 
A = std::allocator<K>>
-class unordered_multiset {};
-template <class K, class H = std::hash<K>, class Eq = std::equal_to<K>, class 
A = std::allocator<K>>
-class unordered_set {};
-
-template <class T, class C = std::deque<T>>
-class stack {};
-} // namespace std
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <set>
+#include <stack>
+#include <unordered_set>
+#include <vector>
 
 namespace absl {
 template <class K, class H = std::hash<K>, class Eq = std::equal_to<K>, class 
A = std::allocator<K>>
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/container-contains.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/readability/container-contains.cpp
index b4aed7b79a722..0cecd936027a5 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability/container-contains.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability/container-contains.cpp
@@ -1,41 +1,8 @@
 // RUN: %check_clang_tidy %s readability-container-contains %t
+#include <map>
+#include <set>
 #include <string>
-
-// Some *very* simplified versions of `map` etc.
-namespace std {
-
-template <class Key, class T>
-struct map {
-  struct iterator {
-    bool operator==(const iterator &Other) const;
-    bool operator!=(const iterator &Other) const;
-  };
-
-  unsigned count(const Key &K) const;
-  bool contains(const Key &K) const;
-  iterator find(const Key &K);
-  iterator end();
-};
-
-template <class Key>
-struct set {
-  unsigned count(const Key &K) const;
-  bool contains(const Key &K) const;
-};
-
-template <class Key>
-struct unordered_set {
-  unsigned count(const Key &K) const;
-  bool contains(const Key &K) const;
-};
-
-template <class Key, class T>
-struct multimap {
-  unsigned count(const Key &K) const;
-  bool contains(const Key &K) const;
-};
-
-} // namespace std
+#include <unordered_set>
 
 // Check that we detect various common ways to check for membership
 int testDifferentCheckTypes(std::map<int, int> &MyMap) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-cxx17.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-cxx17.cpp
index ee22f561fc864..76ec97e2719d5 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-cxx17.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration-cxx17.cpp
@@ -1,28 +1,14 @@
 // RUN: %check_clang_tidy -std=c++17-or-later %s 
readability-isolate-declaration %t
+#include <utility>
 #include <vector>
 
-template <typename T1, typename T2>
-struct pair {
-  T1 first;
-  T2 second;
-  pair(T1 v1, T2 v2) : first(v1), second(v2) {}
-
-  template <int N>
-  decltype(auto) get() const {
-    if constexpr (N == 0)
-      return first;
-    else if constexpr (N == 1)
-      return second;
-  }
-};
-
 void forbidden_transformations() {
   if (int i = 42, j = i; i == j)
     ;
   switch (int i = 12, j = 14; i)
     ;
 
-  auto [i, j] = pair<int, int>(42, 42);
+  auto [i, j] = std::pair<int, int>(42, 42);
 }
 
 struct SomeClass {

>From 62a608bee5c3d8c444771ae4242ea56267c54808 Mon Sep 17 00:00:00 2001
From: Victor Baranov <[email protected]>
Date: Mon, 16 Mar 2026 10:34:52 +0300
Subject: [PATCH 2/2] fix comments

---
 .../clang-tidy/checkers/Inputs/Headers/std/tuple   |  5 -----
 .../checkers/bugprone/unsafe-functions.cpp         |  2 +-
 .../pro-bounds-pointer-arithmetic.cpp              | 14 ++------------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple 
b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
index 1424b95b09355..d867c893c196a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
+++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/std/tuple
@@ -5,11 +5,6 @@
 
 namespace std {
 
-template <typename T, T V>
-struct integral_constant {
-  static constexpr T value = V;
-};
-
 struct _Swallow_assign
 {
   template<class _Tp>
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
index 07a9855858535..59080155ad8c6 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unsafe-functions.cpp
@@ -1,9 +1,9 @@
 // RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-unsafe-functions %t
 
 #include <utility>
+#include <cstddef>
 
 namespace std {
-using ptrdiff_t = long long;
 
 template<class T>
 std::pair<T*, std::ptrdiff_t>
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
index 6c409c6b83452..8110804e2c768 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp
@@ -3,6 +3,7 @@
 // RUN:   -config="{CheckOptions: 
{cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators:
 true}}"
 
 #include <utility>
+#include <map>
 
 enum E {
   ENUM_LITERAL = 1
@@ -123,19 +124,8 @@ void okay() {
 
 namespace gh126424 {
 
-namespace std {
-
-template <typename Key, typename Value>
-class map {
-  public:
-   using value_type = ::std::pair<Key, Value>;
-   value_type& operator[](const Key& key);
-   value_type& operator[](Key&& key);
- };
-}
-
 template <typename R>
-int f(std::map<R*, int>& map, R* r) {
+int f(::std::map<R*, int>& map, R* r) {
   return map[r]; // OK
 }
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to