Repository: llvm/llvm-project
File: clang/test/Analysis/suppress-namespace-redecl-webkit.cpp (C++)

Code before:
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedCallArgsChecker -std=c++20 -verify %s
// expected-no-diagnostics

// Test: [[clang::suppress]] fails for implicit template specializations when
// namespace has multiple redeclarations and suppression is in a different
// redeclaration than the lexical parent of the implicit specialization.
//
// The bug occured when:
// 1. A template is forward-declared in one namespace block
// 2. A partial specialization with [[clang::suppress]] is in a different block
// 3. An implicit instantiation's getLexicalDeclContext() points to the wrong block

typedef __SIZE_TYPE__ size_t;

namespace std {
template<class T> struct remove_cvref { using type = T; };
template<class T> struct remove_cvref<T&> { using type = T; };
template<class T> using remove_cvref_t = typename remove_cvref<T>::type;

template<class... Ts> struct tuple {};
template<size_t I, class T> struct tuple_element;
template<class T, class... Rs> struct tuple_element<0, tuple<T, Rs...>> { using type = T; };
template<size_t I, class T, class... Rs> struct tuple_element<I, tuple<T, Rs...>> : tuple_element<I-1, tuple<Rs...>> {};
template<size_t I, class T> using tuple_element_t = typename tuple_element<I, T>::type;

template<class T> struct optional { T v; T&& operator*() && { return static_cast<T&&>(v); } operator bool() const { return true; } };
template<class T, class... As> optional<T> make_optional(As...);
} // namespace std

namespace WTF { template<class T> T&& move(T&); }

void WTFCrash();
template<class T> struct CanMakeCheckedPtrBase {

Review comment (bug):
```suggestion
// The bug occurred when:
```
Just a spelling fix (I also frequently misspell this word btw).

Code after:
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedCallArgsChecker -std=c++20 -verify %s
// expected-no-diagnostics

// Previously [[clang::suppress]] failed for implicit template specializations when
// namespace has multiple redeclarations and suppression is in a different
// redeclaration than the lexical parent of the implicit specialization.
//
// The bug occurred when:
// 1. A template is forward-declared in one namespace block
// 2. A partial specialization with [[clang::suppress]] is in a different block
// 3. An implicit instantiation's getLexicalDeclContext() points to the wrong block

typedef __SIZE_TYPE__ size_t;

namespace std {
template<class T> struct remove_cvref { using type = T; };
template<class T> struct remove_cvref<T&> { using type = T; };
template<class T> using remove_cvref_t = typename remove_cvref<T>::type;

template<class... Ts> struct tuple {};
template<size_t I, class T> struct tuple_element;
template<class T, class... Rs> struct tuple_element<0, tuple<T, Rs...>> { using type = T; };
template<size_t I, class T, class... Rs> struct tuple_element<I, tuple<T, Rs...>> : tuple_element<I-1, tuple<Rs...>> {};
template<size_t I, class T> using tuple_element_t = typename tuple_element<I, T>::type;

template<class T> struct optional { T v; T&& operator*() && { return static_cast<T&&>(v); } operator bool() const { return true; } };
template<class T, class... As> optional<T> make_optional(As...);
} // namespace std

namespace WTF { template<class T> T&& move(T&); }

void WTFCrash();
template<class T> struct CanMakeCheckedPtrBase {