clang
17.0.0git
include
clang
Sema
TemplateInstCallback.h
Go to the documentation of this file.
1
//===- TemplateInstCallback.h - Template Instantiation Callback - C++ --===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===---------------------------------------------------------------------===//
8
//
9
// This file defines the TemplateInstantiationCallback class, which is the
10
// base class for callbacks that will be notified at template instantiations.
11
//
12
//===---------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_SEMA_TEMPLATEINSTCALLBACK_H
15
#define LLVM_CLANG_SEMA_TEMPLATEINSTCALLBACK_H
16
17
#include "
clang/Sema/Sema.h
"
18
19
namespace
clang
{
20
21
/// This is a base class for callbacks that will be notified at every
22
/// template instantiation.
23
class
TemplateInstantiationCallback
{
24
public
:
25
virtual
~TemplateInstantiationCallback
() =
default
;
26
27
/// Called before doing AST-parsing.
28
virtual
void
initialize
(
const
Sema
&TheSema) = 0;
29
30
/// Called after AST-parsing is completed.
31
virtual
void
finalize
(
const
Sema
&TheSema) = 0;
32
33
/// Called when instantiation of a template just began.
34
virtual
void
atTemplateBegin
(
const
Sema
&TheSema,
35
const
Sema::CodeSynthesisContext
&Inst) = 0;
36
37
/// Called when instantiation of a template is just about to end.
38
virtual
void
atTemplateEnd
(
const
Sema
&TheSema,
39
const
Sema::CodeSynthesisContext
&Inst) = 0;
40
};
41
42
template
<
class
TemplateInstantiationCallbackPtrs>
43
void
initialize
(TemplateInstantiationCallbackPtrs &Callbacks,
44
const
Sema
&TheSema) {
45
for
(
auto
&C : Callbacks) {
46
if
(C)
47
C->initialize(TheSema);
48
}
49
}
50
51
template
<
class
TemplateInstantiationCallbackPtrs>
52
void
finalize
(TemplateInstantiationCallbackPtrs &Callbacks,
53
const
Sema
&TheSema) {
54
for
(
auto
&C : Callbacks) {
55
if
(C)
56
C->finalize(TheSema);
57
}
58
}
59
60
template
<
class
TemplateInstantiationCallbackPtrs>
61
void
atTemplateBegin
(TemplateInstantiationCallbackPtrs &Callbacks,
62
const
Sema
&TheSema,
63
const
Sema::CodeSynthesisContext
&Inst) {
64
for
(
auto
&C : Callbacks) {
65
if
(C)
66
C->atTemplateBegin(TheSema, Inst);
67
}
68
}
69
70
template
<
class
TemplateInstantiationCallbackPtrs>
71
void
atTemplateEnd
(TemplateInstantiationCallbackPtrs &Callbacks,
72
const
Sema
&TheSema,
73
const
Sema::CodeSynthesisContext
&Inst) {
74
for
(
auto
&C : Callbacks) {
75
if
(C)
76
C->atTemplateEnd(TheSema, Inst);
77
}
78
}
79
80
}
// namespace clang
81
82
#endif
clang::initialize
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
Definition:
TemplateInstCallback.h:43
clang::TemplateInstantiationCallback::finalize
virtual void finalize(const Sema &TheSema)=0
Called after AST-parsing is completed.
clang::TemplateInstantiationCallback::atTemplateBegin
virtual void atTemplateBegin(const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)=0
Called when instantiation of a template just began.
clang::TemplateInstantiationCallback::~TemplateInstantiationCallback
virtual ~TemplateInstantiationCallback()=default
clang::TemplateInstantiationCallback::atTemplateEnd
virtual void atTemplateEnd(const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)=0
Called when instantiation of a template is just about to end.
clang::atTemplateEnd
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
Definition:
TemplateInstCallback.h:71
clang::Sema::CodeSynthesisContext
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition:
Sema.h:9186
clang::atTemplateBegin
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
Definition:
TemplateInstCallback.h:61
Sema.h
clang::TemplateInstantiationCallback::initialize
virtual void initialize(const Sema &TheSema)=0
Called before doing AST-parsing.
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition:
Sema.h:358
clang::TemplateInstantiationCallback
This is a base class for callbacks that will be notified at every template instantiation.
Definition:
TemplateInstCallback.h:23
clang
Definition:
CalledOnceCheck.h:17
clang::finalize
void finalize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
Definition:
TemplateInstCallback.h:52
Generated on Sat Jan 28 2023 08:31:56 for clang by
1.8.17