LLDB mainline
ASTUtils.h
Go to the documentation of this file.
1//===-- ASTUtils.h ----------------------------------------------*- 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#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
10#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
11
12#include "clang/Basic/ASTSourceDescriptor.h"
13#include "clang/Sema/Lookup.h"
14#include "clang/Sema/MultiplexExternalSemaSource.h"
15#include "clang/Sema/Sema.h"
16#include "clang/Sema/SemaConsumer.h"
17#include "llvm/ADT/IntrusiveRefCntPtr.h"
18#include "llvm/Support/Casting.h"
19#include <optional>
20
21namespace clang {
22
23class Module;
24
25} // namespace clang
26
27namespace lldb_private {
28
29/// Wraps an ExternalASTSource into an ExternalSemaSource.
30///
31/// Assumes shared ownership of the underlying source.
32class ExternalASTSourceWrapper : public clang::ExternalSemaSource {
33 llvm::IntrusiveRefCntPtr<ExternalASTSource> m_Source;
34
35public:
36 explicit ExternalASTSourceWrapper(ExternalASTSource *Source)
37 : m_Source(Source) {
38 assert(m_Source && "Can't wrap nullptr ExternalASTSource");
39 }
40
42
43 clang::Decl *GetExternalDecl(clang::GlobalDeclID ID) override {
44 return m_Source->GetExternalDecl(ID);
45 }
46
47 clang::Selector GetExternalSelector(uint32_t ID) override {
48 return m_Source->GetExternalSelector(ID);
49 }
50
51 uint32_t GetNumExternalSelectors() override {
52 return m_Source->GetNumExternalSelectors();
53 }
54
55 clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
56 return m_Source->GetExternalDeclStmt(Offset);
57 }
58
59 clang::CXXCtorInitializer **
60 GetExternalCXXCtorInitializers(uint64_t Offset) override {
61 return m_Source->GetExternalCXXCtorInitializers(Offset);
62 }
63
64 clang::CXXBaseSpecifier *
65 GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
66 return m_Source->GetExternalCXXBaseSpecifiers(Offset);
67 }
68
69 void updateOutOfDateIdentifier(const clang::IdentifierInfo &II) override {
70 m_Source->updateOutOfDateIdentifier(II);
71 }
72
73 bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
74 clang::DeclarationName Name) override {
75 return m_Source->FindExternalVisibleDeclsByName(DC, Name);
76 }
77
78 void completeVisibleDeclsMap(const clang::DeclContext *DC) override {
79 m_Source->completeVisibleDeclsMap(DC);
80 }
81
82 clang::Module *getModule(unsigned ID) override {
83 return m_Source->getModule(ID);
84 }
85
86 std::optional<clang::ASTSourceDescriptor>
87 getSourceDescriptor(unsigned ID) override {
88 return m_Source->getSourceDescriptor(ID);
89 }
90
91 ExtKind hasExternalDefinitions(const clang::Decl *D) override {
92 return m_Source->hasExternalDefinitions(D);
93 }
94
96 const clang::DeclContext *DC,
97 llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
98 llvm::SmallVectorImpl<clang::Decl *> &Result) override {
99 m_Source->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
100 }
101
102 void
103 FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length,
104 llvm::SmallVectorImpl<clang::Decl *> &Decls) override {
105 m_Source->FindFileRegionDecls(File, Offset, Length, Decls);
106 }
107
108 void CompleteRedeclChain(const clang::Decl *D) override {
109 m_Source->CompleteRedeclChain(D);
110 }
111
112 void CompleteType(clang::TagDecl *Tag) override {
113 m_Source->CompleteType(Tag);
114 }
115
116 void CompleteType(clang::ObjCInterfaceDecl *Class) override {
117 m_Source->CompleteType(Class);
118 }
119
120 void ReadComments() override { m_Source->ReadComments(); }
121
122 void StartedDeserializing() override { m_Source->StartedDeserializing(); }
123
124 void FinishedDeserializing() override { m_Source->FinishedDeserializing(); }
125
126 void StartTranslationUnit(clang::ASTConsumer *Consumer) override {
127 m_Source->StartTranslationUnit(Consumer);
128 }
129
130 void PrintStats() override;
131
133 const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
134 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
135 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
136 &BaseOffsets,
137 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
138 &VirtualBaseOffsets) override {
139 return m_Source->layoutRecordType(Record, Size, Alignment, FieldOffsets,
140 BaseOffsets, VirtualBaseOffsets);
141 }
142
143 /// This gets called when Sema is reconciling undefined but used decls.
144 /// For LLDB's use-case, we never provide Clang with function definitions,
145 /// instead we rely on linkage names and symbol resolution to call the
146 /// correct funcitons during JITting. So this implementation clears
147 /// any "undefined" FunctionDecls that Clang found while parsing.
148 ///
149 /// \param[in,out] Undefined A set of used decls for which Clang has not
150 /// been provided a definition with.
151 ///
153 llvm::MapVector<clang::NamedDecl *, clang::SourceLocation> &Undefined)
154 override {
155 Undefined.remove_if([](auto const &decl_loc_pair) {
156 const clang::NamedDecl *ND = decl_loc_pair.first;
157 return llvm::isa_and_present<clang::FunctionDecl>(ND);
158 });
159 }
160};
161
162/// Wraps an ASTConsumer into an SemaConsumer. Doesn't take ownership of the
163/// provided consumer. If the provided ASTConsumer is also a SemaConsumer,
164/// the wrapper will also forward SemaConsumer functions.
165class ASTConsumerForwarder : public clang::SemaConsumer {
166 clang::ASTConsumer *m_c;
167 clang::SemaConsumer *m_sc;
168
169public:
170 ASTConsumerForwarder(clang::ASTConsumer *c) : m_c(c) {
171 m_sc = llvm::dyn_cast<clang::SemaConsumer>(m_c);
172 }
173
175
176 void Initialize(clang::ASTContext &Context) override {
177 m_c->Initialize(Context);
178 }
179
180 bool HandleTopLevelDecl(clang::DeclGroupRef D) override {
181 return m_c->HandleTopLevelDecl(D);
182 }
183
184 void HandleInlineFunctionDefinition(clang::FunctionDecl *D) override {
185 m_c->HandleInlineFunctionDefinition(D);
186 }
187
188 void HandleInterestingDecl(clang::DeclGroupRef D) override {
189 m_c->HandleInterestingDecl(D);
190 }
191
192 void HandleTranslationUnit(clang::ASTContext &Ctx) override {
193 m_c->HandleTranslationUnit(Ctx);
194 }
195
196 void HandleTagDeclDefinition(clang::TagDecl *D) override {
197 m_c->HandleTagDeclDefinition(D);
198 }
199
200 void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override {
201 m_c->HandleTagDeclRequiredDefinition(D);
202 }
203
204 void HandleCXXImplicitFunctionInstantiation(clang::FunctionDecl *D) override {
205 m_c->HandleCXXImplicitFunctionInstantiation(D);
206 }
207
208 void HandleTopLevelDeclInObjCContainer(clang::DeclGroupRef D) override {
209 m_c->HandleTopLevelDeclInObjCContainer(D);
210 }
211
212 void HandleImplicitImportDecl(clang::ImportDecl *D) override {
213 m_c->HandleImplicitImportDecl(D);
214 }
215
216 void CompleteTentativeDefinition(clang::VarDecl *D) override {
217 m_c->CompleteTentativeDefinition(D);
218 }
219
220 void AssignInheritanceModel(clang::CXXRecordDecl *RD) override {
221 m_c->AssignInheritanceModel(RD);
222 }
223
224 void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override {
225 m_c->HandleCXXStaticMemberVarInstantiation(D);
226 }
227
228 void HandleVTable(clang::CXXRecordDecl *RD) override {
229 m_c->HandleVTable(RD);
230 }
231
232 clang::ASTMutationListener *GetASTMutationListener() override {
233 return m_c->GetASTMutationListener();
234 }
235
236 clang::ASTDeserializationListener *GetASTDeserializationListener() override {
237 return m_c->GetASTDeserializationListener();
238 }
239
240 void PrintStats() override;
241
242 void InitializeSema(clang::Sema &S) override {
243 if (m_sc)
244 m_sc->InitializeSema(S);
245 }
246
247 /// Inform the semantic consumer that Sema is no longer available.
248 void ForgetSema() override {
249 if (m_sc)
250 m_sc->ForgetSema();
251 }
252
253 bool shouldSkipFunctionBody(clang::Decl *D) override {
254 return m_c->shouldSkipFunctionBody(D);
255 }
256};
257
258/// A ExternalSemaSource multiplexer that prioritizes its sources.
259///
260/// This ExternalSemaSource will forward all requests to its attached sources.
261/// However, unlike a normal multiplexer it will not forward a request to all
262/// sources, but instead give priority to certain sources. If a source with a
263/// higher priority can fulfill a request, all sources with a lower priority
264/// will not receive the request.
265///
266/// This class is mostly use to multiplex between sources of different
267/// 'quality', e.g. a C++ modules and debug information. The C++ module will
268/// provide more accurate replies to the requests, but might not be able to
269/// answer all requests. The debug information will be used as a fallback then
270/// to provide information that is not in the C++ module.
271class SemaSourceWithPriorities : public clang::ExternalSemaSource {
272
273private:
274 /// The sources ordered in decreasing priority.
275 llvm::SmallVector<clang::ExternalSemaSource *, 2> Sources;
276
277public:
278 /// Construct a SemaSourceWithPriorities with a 'high quality' source that
279 /// has the higher priority and a 'low quality' source that will be used
280 /// as a fallback.
281 ///
282 /// This class assumes shared ownership of the sources provided to it.
283 SemaSourceWithPriorities(clang::ExternalSemaSource *high_quality_source,
284 clang::ExternalSemaSource *low_quality_source) {
285 assert(high_quality_source);
286 assert(low_quality_source);
287
288 high_quality_source->Retain();
289 low_quality_source->Retain();
290
291 Sources.push_back(high_quality_source);
292 Sources.push_back(low_quality_source);
293 }
294
295 ~SemaSourceWithPriorities() override;
296
297 //===--------------------------------------------------------------------===//
298 // ExternalASTSource.
299 //===--------------------------------------------------------------------===//
300
301 clang::Decl *GetExternalDecl(clang::GlobalDeclID ID) override {
302 for (size_t i = 0; i < Sources.size(); ++i)
303 if (clang::Decl *Result = Sources[i]->GetExternalDecl(ID))
304 return Result;
305 return nullptr;
306 }
307
308 void CompleteRedeclChain(const clang::Decl *D) override {
309 for (size_t i = 0; i < Sources.size(); ++i)
311 }
312
313 clang::Selector GetExternalSelector(uint32_t ID) override {
314 clang::Selector Sel;
315 for (size_t i = 0; i < Sources.size(); ++i) {
316 Sel = Sources[i]->GetExternalSelector(ID);
317 if (!Sel.isNull())
318 return Sel;
319 }
320 return Sel;
321 }
322
323 uint32_t GetNumExternalSelectors() override {
324 for (size_t i = 0; i < Sources.size(); ++i)
325 if (uint32_t total = Sources[i]->GetNumExternalSelectors())
326 return total;
327 return 0;
328 }
329
330 clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
331 for (size_t i = 0; i < Sources.size(); ++i)
332 if (clang::Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
333 return Result;
334 return nullptr;
335 }
336
337 clang::CXXBaseSpecifier *
338 GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
339 for (size_t i = 0; i < Sources.size(); ++i)
340 if (clang::CXXBaseSpecifier *R =
342 return R;
343 return nullptr;
344 }
345
346 clang::CXXCtorInitializer **
347 GetExternalCXXCtorInitializers(uint64_t Offset) override {
348 for (auto *S : Sources)
349 if (auto *R = S->GetExternalCXXCtorInitializers(Offset))
350 return R;
351 return nullptr;
352 }
353
354 ExtKind hasExternalDefinitions(const clang::Decl *D) override {
355 for (const auto &S : Sources)
356 if (auto EK = S->hasExternalDefinitions(D))
357 if (EK != EK_ReplyHazy)
358 return EK;
359 return EK_ReplyHazy;
360 }
361
362 bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
363 clang::DeclarationName Name) override {
364 for (size_t i = 0; i < Sources.size(); ++i)
365 if (Sources[i]->FindExternalVisibleDeclsByName(DC, Name))
366 return true;
367 return false;
368 }
369
370 void completeVisibleDeclsMap(const clang::DeclContext *DC) override {
371 // FIXME: Only one source should be able to complete the decls map.
372 for (size_t i = 0; i < Sources.size(); ++i)
374 }
375
377 const clang::DeclContext *DC,
378 llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
379 llvm::SmallVectorImpl<clang::Decl *> &Result) override {
380 for (size_t i = 0; i < Sources.size(); ++i) {
381 Sources[i]->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
382 if (!Result.empty())
383 return;
384 }
385 }
386
387 void
388 FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length,
389 llvm::SmallVectorImpl<clang::Decl *> &Decls) override {
390 for (size_t i = 0; i < Sources.size(); ++i)
391 Sources[i]->FindFileRegionDecls(File, Offset, Length, Decls);
392 }
393
394 void CompleteType(clang::TagDecl *Tag) override {
395 for (clang::ExternalSemaSource *S : Sources) {
396 S->CompleteType(Tag);
397 // Stop after the first source completed the type.
398 if (Tag->isCompleteDefinition())
399 break;
400 }
401 }
402
403 void CompleteType(clang::ObjCInterfaceDecl *Class) override {
404 for (size_t i = 0; i < Sources.size(); ++i)
405 Sources[i]->CompleteType(Class);
406 }
407
408 void ReadComments() override {
409 for (size_t i = 0; i < Sources.size(); ++i)
410 Sources[i]->ReadComments();
411 }
412
413 void StartedDeserializing() override {
414 for (size_t i = 0; i < Sources.size(); ++i)
416 }
417
418 void FinishedDeserializing() override {
419 for (size_t i = 0; i < Sources.size(); ++i)
421 }
422
423 void StartTranslationUnit(clang::ASTConsumer *Consumer) override {
424 for (size_t i = 0; i < Sources.size(); ++i)
425 Sources[i]->StartTranslationUnit(Consumer);
426 }
427
428 void PrintStats() override;
429
430 clang::Module *getModule(unsigned ID) override {
431 for (size_t i = 0; i < Sources.size(); ++i)
432 if (auto M = Sources[i]->getModule(ID))
433 return M;
434 return nullptr;
435 }
436
438 const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
439 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
440 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
441 &BaseOffsets,
442 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
443 &VirtualBaseOffsets) override {
444 for (size_t i = 0; i < Sources.size(); ++i)
445 if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
446 BaseOffsets, VirtualBaseOffsets))
447 return true;
448 return false;
449 }
450
451 void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override {
452 for (auto &Source : Sources)
453 Source->getMemoryBufferSizes(sizes);
454 }
455
456 //===--------------------------------------------------------------------===//
457 // ExternalSemaSource.
458 //===--------------------------------------------------------------------===//
459
460 void InitializeSema(clang::Sema &S) override {
461 for (auto &Source : Sources)
462 Source->InitializeSema(S);
463 }
464
465 void ForgetSema() override {
466 for (auto &Source : Sources)
467 Source->ForgetSema();
468 }
469
470 void ReadMethodPool(clang::Selector Sel) override {
471 for (auto &Source : Sources)
472 Source->ReadMethodPool(Sel);
473 }
474
475 void updateOutOfDateSelector(clang::Selector Sel) override {
476 for (auto &Source : Sources)
477 Source->updateOutOfDateSelector(Sel);
478 }
479
482 for (auto &Source : Sources)
483 Source->ReadKnownNamespaces(Namespaces);
484 }
485
487 llvm::MapVector<clang::NamedDecl *, clang::SourceLocation> &Undefined)
488 override {
489 for (auto &Source : Sources)
490 Source->ReadUndefinedButUsed(Undefined);
491 }
492
494 llvm::MapVector<clang::FieldDecl *,
495 llvm::SmallVector<std::pair<clang::SourceLocation, bool>,
496 4>> &Exprs) override {
497 for (auto &Source : Sources)
498 Source->ReadMismatchingDeleteExpressions(Exprs);
499 }
500
501 bool LookupUnqualified(clang::LookupResult &R, clang::Scope *S) override {
502 for (auto &Source : Sources) {
503 Source->LookupUnqualified(R, S);
504 if (!R.empty())
505 break;
506 }
507
508 return !R.empty();
509 }
510
513 for (auto &Source : Sources)
514 Source->ReadTentativeDefinitions(Defs);
515 }
516
519 for (auto &Source : Sources)
520 Source->ReadUnusedFileScopedDecls(Decls);
521 }
522
525 for (auto &Source : Sources)
526 Source->ReadDelegatingConstructors(Decls);
527 }
528
531 for (auto &Source : Sources)
532 Source->ReadExtVectorDecls(Decls);
533 }
534
536 llvm::SmallSetVector<const clang::TypedefNameDecl *, 4> &Decls) override {
537 for (auto &Source : Sources)
538 Source->ReadUnusedLocalTypedefNameCandidates(Decls);
539 }
540
542 llvm::SmallVectorImpl<std::pair<clang::Selector, clang::SourceLocation>>
543 &Sels) override {
544 for (auto &Source : Sources)
545 Source->ReadReferencedSelectors(Sels);
546 }
547
549 llvm::SmallVectorImpl<std::pair<clang::IdentifierInfo *, clang::WeakInfo>>
550 &WI) override {
551 for (auto &Source : Sources)
552 Source->ReadWeakUndeclaredIdentifiers(WI);
553 }
554
557 for (auto &Source : Sources)
558 Source->ReadUsedVTables(VTables);
559 }
560
563 std::pair<clang::ValueDecl *, clang::SourceLocation>> &Pending)
564 override {
565 for (auto &Source : Sources)
566 Source->ReadPendingInstantiations(Pending);
567 }
568
570 llvm::MapVector<const clang::FunctionDecl *,
571 std::unique_ptr<clang::LateParsedTemplate>> &LPTMap)
572 override {
573 for (auto &Source : Sources)
574 Source->ReadLateParsedTemplates(LPTMap);
575 }
576
577 clang::TypoCorrection
578 CorrectTypo(const clang::DeclarationNameInfo &Typo, int LookupKind,
579 clang::Scope *S, clang::CXXScopeSpec *SS,
580 clang::CorrectionCandidateCallback &CCC,
581 clang::DeclContext *MemberContext, bool EnteringContext,
582 const clang::ObjCObjectPointerType *OPT) override {
583 for (auto &Source : Sources) {
584 if (clang::TypoCorrection C =
585 Source->CorrectTypo(Typo, LookupKind, S, SS, CCC,
586 MemberContext, EnteringContext, OPT))
587 return C;
588 }
589 return clang::TypoCorrection();
590 }
591
592 bool MaybeDiagnoseMissingCompleteType(clang::SourceLocation Loc,
593 clang::QualType T) override {
594 for (auto &Source : Sources) {
595 if (Source->MaybeDiagnoseMissingCompleteType(Loc, T))
596 return true;
597 }
598 return false;
599 }
600};
601
602} // namespace lldb_private
603#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
static char ID
Definition: HostInfoBase.h:37
Wraps an ASTConsumer into an SemaConsumer.
Definition: ASTUtils.h:165
void HandleTranslationUnit(clang::ASTContext &Ctx) override
Definition: ASTUtils.h:192
void HandleInlineFunctionDefinition(clang::FunctionDecl *D) override
Definition: ASTUtils.h:184
void InitializeSema(clang::Sema &S) override
Definition: ASTUtils.h:242
void HandleInterestingDecl(clang::DeclGroupRef D) override
Definition: ASTUtils.h:188
ASTConsumerForwarder(clang::ASTConsumer *c)
Definition: ASTUtils.h:170
bool shouldSkipFunctionBody(clang::Decl *D) override
Definition: ASTUtils.h:253
void HandleTagDeclDefinition(clang::TagDecl *D) override
Definition: ASTUtils.h:196
void AssignInheritanceModel(clang::CXXRecordDecl *RD) override
Definition: ASTUtils.h:220
clang::SemaConsumer * m_sc
Definition: ASTUtils.h:167
void HandleTopLevelDeclInObjCContainer(clang::DeclGroupRef D) override
Definition: ASTUtils.h:208
clang::ASTDeserializationListener * GetASTDeserializationListener() override
Definition: ASTUtils.h:236
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
Definition: ASTUtils.h:248
bool HandleTopLevelDecl(clang::DeclGroupRef D) override
Definition: ASTUtils.h:180
void HandleCXXImplicitFunctionInstantiation(clang::FunctionDecl *D) override
Definition: ASTUtils.h:204
void CompleteTentativeDefinition(clang::VarDecl *D) override
Definition: ASTUtils.h:216
void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override
Definition: ASTUtils.h:200
void HandleVTable(clang::CXXRecordDecl *RD) override
Definition: ASTUtils.h:228
void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override
Definition: ASTUtils.h:224
void Initialize(clang::ASTContext &Context) override
Definition: ASTUtils.h:176
clang::ASTConsumer * m_c
Definition: ASTUtils.h:166
void HandleImplicitImportDecl(clang::ImportDecl *D) override
Definition: ASTUtils.h:212
clang::ASTMutationListener * GetASTMutationListener() override
Definition: ASTUtils.h:232
Wraps an ExternalASTSource into an ExternalSemaSource.
Definition: ASTUtils.h:32
std::optional< clang::ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Definition: ASTUtils.h:87
void ReadUndefinedButUsed(llvm::MapVector< clang::NamedDecl *, clang::SourceLocation > &Undefined) override
This gets called when Sema is reconciling undefined but used decls.
Definition: ASTUtils.h:152
clang::Module * getModule(unsigned ID) override
Definition: ASTUtils.h:82
clang::Selector GetExternalSelector(uint32_t ID) override
Definition: ASTUtils.h:47
ExtKind hasExternalDefinitions(const clang::Decl *D) override
Definition: ASTUtils.h:91
clang::Stmt * GetExternalDeclStmt(uint64_t Offset) override
Definition: ASTUtils.h:55
void completeVisibleDeclsMap(const clang::DeclContext *DC) override
Definition: ASTUtils.h:78
llvm::IntrusiveRefCntPtr< ExternalASTSource > m_Source
Definition: ASTUtils.h:33
ExternalASTSourceWrapper(ExternalASTSource *Source)
Definition: ASTUtils.h:36
bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override
Definition: ASTUtils.h:73
void FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length, llvm::SmallVectorImpl< clang::Decl * > &Decls) override
Definition: ASTUtils.h:103
void CompleteType(clang::ObjCInterfaceDecl *Class) override
Definition: ASTUtils.h:116
clang::Decl * GetExternalDecl(clang::GlobalDeclID ID) override
Definition: ASTUtils.h:43
uint32_t GetNumExternalSelectors() override
Definition: ASTUtils.h:51
void FindExternalLexicalDecls(const clang::DeclContext *DC, llvm::function_ref< bool(clang::Decl::Kind)> IsKindWeWant, llvm::SmallVectorImpl< clang::Decl * > &Result) override
Definition: ASTUtils.h:95
clang::CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Definition: ASTUtils.h:65
void StartTranslationUnit(clang::ASTConsumer *Consumer) override
Definition: ASTUtils.h:126
void CompleteRedeclChain(const clang::Decl *D) override
Definition: ASTUtils.h:108
clang::CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Definition: ASTUtils.h:60
void updateOutOfDateIdentifier(const clang::IdentifierInfo &II) override
Definition: ASTUtils.h:69
bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &BaseOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &VirtualBaseOffsets) override
Definition: ASTUtils.h:132
void CompleteType(clang::TagDecl *Tag) override
Definition: ASTUtils.h:112
An abstract base class for files.
Definition: File.h:36
A ExternalSemaSource multiplexer that prioritizes its sources.
Definition: ASTUtils.h:271
void ReadUndefinedButUsed(llvm::MapVector< clang::NamedDecl *, clang::SourceLocation > &Undefined) override
Definition: ASTUtils.h:486
void ReadKnownNamespaces(llvm::SmallVectorImpl< clang::NamespaceDecl * > &Namespaces) override
Definition: ASTUtils.h:480
void ReadExtVectorDecls(llvm::SmallVectorImpl< clang::TypedefNameDecl * > &Decls) override
Definition: ASTUtils.h:529
uint32_t GetNumExternalSelectors() override
Definition: ASTUtils.h:323
bool MaybeDiagnoseMissingCompleteType(clang::SourceLocation Loc, clang::QualType T) override
Definition: ASTUtils.h:592
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const clang::TypedefNameDecl *, 4 > &Decls) override
Definition: ASTUtils.h:535
clang::Selector GetExternalSelector(uint32_t ID) override
Definition: ASTUtils.h:313
clang::Module * getModule(unsigned ID) override
Definition: ASTUtils.h:430
void FindExternalLexicalDecls(const clang::DeclContext *DC, llvm::function_ref< bool(clang::Decl::Kind)> IsKindWeWant, llvm::SmallVectorImpl< clang::Decl * > &Result) override
Definition: ASTUtils.h:376
bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override
Definition: ASTUtils.h:362
void ReadUsedVTables(llvm::SmallVectorImpl< clang::ExternalVTableUse > &VTables) override
Definition: ASTUtils.h:555
clang::TypoCorrection CorrectTypo(const clang::DeclarationNameInfo &Typo, int LookupKind, clang::Scope *S, clang::CXXScopeSpec *SS, clang::CorrectionCandidateCallback &CCC, clang::DeclContext *MemberContext, bool EnteringContext, const clang::ObjCObjectPointerType *OPT) override
Definition: ASTUtils.h:578
SemaSourceWithPriorities(clang::ExternalSemaSource *high_quality_source, clang::ExternalSemaSource *low_quality_source)
Construct a SemaSourceWithPriorities with a 'high quality' source that has the higher priority and a ...
Definition: ASTUtils.h:283
void CompleteRedeclChain(const clang::Decl *D) override
Definition: ASTUtils.h:308
clang::Stmt * GetExternalDeclStmt(uint64_t Offset) override
Definition: ASTUtils.h:330
void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override
Definition: ASTUtils.h:451
clang::Decl * GetExternalDecl(clang::GlobalDeclID ID) override
Definition: ASTUtils.h:301
void StartTranslationUnit(clang::ASTConsumer *Consumer) override
Definition: ASTUtils.h:423
clang::CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Definition: ASTUtils.h:347
void ReadTentativeDefinitions(llvm::SmallVectorImpl< clang::VarDecl * > &Defs) override
Definition: ASTUtils.h:511
void ReadReferencedSelectors(llvm::SmallVectorImpl< std::pair< clang::Selector, clang::SourceLocation > > &Sels) override
Definition: ASTUtils.h:541
void ReadLateParsedTemplates(llvm::MapVector< const clang::FunctionDecl *, std::unique_ptr< clang::LateParsedTemplate > > &LPTMap) override
Definition: ASTUtils.h:569
bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &BaseOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &VirtualBaseOffsets) override
Definition: ASTUtils.h:437
void ReadMethodPool(clang::Selector Sel) override
Definition: ASTUtils.h:470
clang::CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Definition: ASTUtils.h:338
void CompleteType(clang::TagDecl *Tag) override
Definition: ASTUtils.h:394
llvm::SmallVector< clang::ExternalSemaSource *, 2 > Sources
The sources ordered in decreasing priority.
Definition: ASTUtils.h:275
void FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length, llvm::SmallVectorImpl< clang::Decl * > &Decls) override
Definition: ASTUtils.h:388
void ReadUnusedFileScopedDecls(llvm::SmallVectorImpl< const clang::DeclaratorDecl * > &Decls) override
Definition: ASTUtils.h:517
void CompleteType(clang::ObjCInterfaceDecl *Class) override
Definition: ASTUtils.h:403
void completeVisibleDeclsMap(const clang::DeclContext *DC) override
Definition: ASTUtils.h:370
void ReadPendingInstantiations(llvm::SmallVectorImpl< std::pair< clang::ValueDecl *, clang::SourceLocation > > &Pending) override
Definition: ASTUtils.h:561
void ReadDelegatingConstructors(llvm::SmallVectorImpl< clang::CXXConstructorDecl * > &Decls) override
Definition: ASTUtils.h:523
bool LookupUnqualified(clang::LookupResult &R, clang::Scope *S) override
Definition: ASTUtils.h:501
void updateOutOfDateSelector(clang::Selector Sel) override
Definition: ASTUtils.h:475
void ReadWeakUndeclaredIdentifiers(llvm::SmallVectorImpl< std::pair< clang::IdentifierInfo *, clang::WeakInfo > > &WI) override
Definition: ASTUtils.h:548
void ReadMismatchingDeleteExpressions(llvm::MapVector< clang::FieldDecl *, llvm::SmallVector< std::pair< clang::SourceLocation, bool >, 4 > > &Exprs) override
Definition: ASTUtils.h:493
ExtKind hasExternalDefinitions(const clang::Decl *D) override
Definition: ASTUtils.h:354
void InitializeSema(clang::Sema &S) override
Definition: ASTUtils.h:460
A class that represents a running process on the host machine.