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