[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / Inputs / DebugCXX.h
blob8f83c0bc69dba714a9b758adc8c513c6db352ab7
1 /* -*- C++ -*- */
3 #include "dummy.h"
5 namespace DebugCXX {
6 // Records.
7 struct Struct {
8 int i;
9 static int static_member;
12 // Enums.
13 enum Enum {
14 Enumerator
16 enum {
17 e1 = '1'
19 enum {
20 e2 = '2'
23 // Templates (instantiations).
24 template<typename T> struct traits {};
25 template<typename T,
26 typename Traits = traits<T>
27 > class Template {
28 T member;
30 // Explicit template instantiation.
31 extern template class Template<int>;
33 extern template struct traits<float>;
34 typedef class Template<float> FloatInstantiation;
36 inline void fn() {
37 Template<long> invisible;
40 // Non-template inside a template.
41 template <class> struct Outer {
42 Outer();
43 struct Inner {
44 Inner(Outer) {}
47 template <class T> Outer<T>::Outer() {
48 Inner a(*this);
51 // Partial template specialization.
52 template <typename...> class A;
53 template <typename T> class A<T> {};
54 typedef A<void> B;
55 // Anchored by a function parameter.
56 void foo(B) {}
59 // Virtual class with a forward declaration.
60 struct Virtual;
61 struct Virtual {
62 virtual ~Virtual() {}
65 struct PureForwardDecl;
67 typedef union { int i; } TypedefUnion;
68 typedef enum { e0 = 0 } TypedefEnum;
69 typedef struct { int i; } TypedefStruct;
71 union { int i; } GlobalUnion;
72 struct { int i; } GlobalStruct;
73 enum { e5 = 5 } GlobalEnum;
75 namespace {
76 namespace {
77 struct InAnonymousNamespace { int i; };
81 class Base;
82 class A {
83 virtual Base *getParent() const;
85 class Base {};
86 class Derived : Base {
87 class B : A {
88 Derived *getParent() const override;
92 template <class T>
93 class Template1 {
94 T t;
96 typedef Template1<void *> TypedefTemplate;
97 extern template class Template1<int>;
99 template <class T> class FwdDeclTemplate;
100 typedef FwdDeclTemplate<int> TypedefFwdDeclTemplate;
102 // Member classes of class template specializations.
103 template <typename T> struct Specialized {};
105 template <> struct Specialized<int> {
106 struct Member;
109 template <class T> struct FwdDeclTemplateMember { struct Member; };
110 typedef FwdDeclTemplateMember<int>::Member TypedefFwdDeclTemplateMember;
112 // Base class specialized on the class itself.
113 template <typename Derived> class BaseTemplate {};
114 template <typename T>
115 class WithSpecializedBase : public BaseTemplate<WithSpecializedBase<T>> {};
116 typedef WithSpecializedBase<float> SpecializedBase;