clang: include/clang/Sema/SemaBase.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_SEMA_SEMABASE_H
15#define LLVM_CLANG_SEMA_SEMABASE_H
16
23#include "llvm/ADT/DenseMap.h"
24#include
25#include <type_traits>
26#include
27#include
28
30
31class ASTContext;
32class DiagnosticsEngine;
33class LangOptions;
34class Sema;
35
37public:
39
41
45
46
47
48
49
50
51
52
53
54
56 Sema &SemaRef;
57 unsigned DiagID;
58
59 public:
64
65
66
67
68
69
70
72
74
75
76 template
80 BaseDiag << Value;
82 }
83
84
85
86
87 template <typename T,
88 typename = std::enable_if_t<!std::is_lvalue_reference::value>>
91 BaseDiag << std::move(V);
92 return *this;
93 }
94 };
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
111 public:
113
115
117
118
119
121
122
123
126
131
132
133
136
138
139 bool isImmediate() const { return ImmediateDiag.has_value(); }
140
141
142
143
144
145
146
147
148
149
150
152
153 template
156 if (Diag.ImmediateDiag)
158 else if (Diag.PartialDiagId)
159 Diag.getDeviceDeferredDiags()[Diag.Fn][*Diag.PartialDiagId].second
162 }
163
164
165
166
167 template <typename T,
168 typename = std::enable_if_t<!std::is_lvalue_reference::value>>
170 if (ImmediateDiag)
171 *ImmediateDiag << std::move(V);
172 else if (PartialDiagId)
173 getDeviceDeferredDiags()[Fn][*PartialDiagId].second << std::move(V);
174 return *this;
175 }
176
179
181
184 }
187 }
193
195 llvm::DenseMap<CanonicalDeclPtr,
196 std::vector>;
197
198 private:
201 unsigned DiagID;
203 bool ShowCallStack;
204
205
206
207 std::optional ImmediateDiag;
208 std::optional PartialDiagId;
209
211 };
212
213
215 bool DeferHint = false);
216
217
219 bool DeferHint = false);
220
221
223};
224
225}
226
227#endif
Defines the Diagnostic-related interfaces.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A little helper class used to produce diagnostics.
Concrete class used by the front-end to report problems and issues.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Represents a function declaration or definition.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
@ K_Nop
Emit no diagnostics.
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
void AddFixItHint(const FixItHint &Hint) const
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, const FunctionDecl *Fn, Sema &S)
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< PartialDiagnosticAt > > DeferredDiagnosticsType
const SemaDiagnosticBuilder & operator<<(T &&V) const
SemaDiagnosticBuilder & operator=(const SemaDiagnosticBuilder &)=delete
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
SemaDiagnosticBuilder & operator=(SemaDiagnosticBuilder &&)=delete
SemaDiagnosticBuilder(SemaDiagnosticBuilder &&D)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.
ActionResult< CXXCtorInitializer * > MemInitResult
ActionResult< Expr * > ExprResult
ActionResult< Stmt * > StmtResult
ActionResult< ParsedType > TypeResult
const FunctionProtoType * T
ActionResult< Decl * > DeclResult