Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
Line
Count
Source (jump to first uncovered line)
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
1.57k
  ExternalASTSourceWrapper(ExternalASTSource *Source) : m_Source(Source) {
27
1.57k
    assert(m_Source && "Can't wrap nullptr ExternalASTSource");
28
1.57k
  }
29
30
  ~ExternalASTSourceWrapper() override;
31
32
888k
  clang::Decl *GetExternalDecl(uint32_t ID) override {
33
888k
    return m_Source->GetExternalDecl(ID);
34
888k
  }
35
36
0
  clang::Selector GetExternalSelector(uint32_t ID) override {
37
0
    return m_Source->GetExternalSelector(ID);
38
0
  }
39
40
0
  uint32_t GetNumExternalSelectors() override {
41
0
    return m_Source->GetNumExternalSelectors();
42
0
  }
43
44
184k
  clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
45
184k
    return m_Source->GetExternalDeclStmt(Offset);
46
184k
  }
47
48
  clang::CXXCtorInitializer **
49
24.3k
  GetExternalCXXCtorInitializers(uint64_t Offset) override {
50
24.3k
    return m_Source->GetExternalCXXCtorInitializers(Offset);
51
24.3k
  }
52
53
  clang::CXXBaseSpecifier *
54
30.8k
  GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
55
30.8k
    return m_Source->GetExternalCXXBaseSpecifiers(Offset);
56
30.8k
  }
57
58
0
  void updateOutOfDateIdentifier(clang::IdentifierInfo &II) override {
59
0
    m_Source->updateOutOfDateIdentifier(II);
60
0
  }
61
62
  bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
63
488k
                                      clang::DeclarationName Name) override {
64
488k
    return m_Source->FindExternalVisibleDeclsByName(DC, Name);
65
488k
  }
66
67
0
  void completeVisibleDeclsMap(const clang::DeclContext *DC) override {
68
0
    m_Source->completeVisibleDeclsMap(DC);
69
0
  }
70
71
1.18M
  clang::Module *getModule(unsigned ID) override {
72
1.18M
    return m_Source->getModule(ID);
73
1.18M
  }
74
75
  llvm::Optional<clang::ASTSourceDescriptor>
76
0
  getSourceDescriptor(unsigned ID) override {
77
0
    return m_Source->getSourceDescriptor(ID);
78
0
  }
79
80
7.87M
  ExtKind hasExternalDefinitions(const clang::Decl *D) override {
81
7.87M
    return m_Source->hasExternalDefinitions(D);
82
7.87M
  }
83
84
  void FindExternalLexicalDecls(
85
      const clang::DeclContext *DC,
86
      llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
87
80.1k
      llvm::SmallVectorImpl<clang::Decl *> &Result) override {
88
80.1k
    m_Source->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
89
80.1k
  }
90
91
  void
92
  FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length,
93
0
                      llvm::SmallVectorImpl<clang::Decl *> &Decls) override {
94
0
    m_Source->FindFileRegionDecls(File, Offset, Length, Decls);
95
0
  }
96
97
3.79M
  void CompleteRedeclChain(const clang::Decl *D) override {
98
3.79M
    m_Source->CompleteRedeclChain(D);
99
3.79M
  }
100
101
39.0k
  void CompleteType(clang::TagDecl *Tag) override {
102
39.0k
    m_Source->CompleteType(Tag);
103
39.0k
  }
104
105
0
  void CompleteType(clang::ObjCInterfaceDecl *Class) override {
106
0
    m_Source->CompleteType(Class);
107
0
  }
108
109
0
  void ReadComments() override { m_Source->ReadComments(); }
110
111
152k
  void StartedDeserializing() override { m_Source->StartedDeserializing(); }
112
113
152k
  void FinishedDeserializing() override { m_Source->FinishedDeserializing(); }
114
115
1.57k
  void StartTranslationUnit(clang::ASTConsumer *Consumer) override {
116
1.57k
    m_Source->StartTranslationUnit(Consumer);
117
1.57k
  }
118
119
  void PrintStats() override;
120
121
  bool layoutRecordType(
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
15.0k
          &VirtualBaseOffsets) override {
128
15.0k
    return m_Source->layoutRecordType(Record, Size, Alignment, FieldOffsets,
129
15.0k
                                      BaseOffsets, VirtualBaseOffsets);
130
15.0k
  }
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
15.2k
  ASTConsumerForwarder(clang::ASTConsumer *c) : m_c(c) {
142
15.2k
    m_sc = llvm::dyn_cast<clang::SemaConsumer>(m_c);
143
15.2k
  }
144
145
  ~ASTConsumerForwarder() override;
146
147
15.2k
  void Initialize(clang::ASTContext &Context) override {
148
15.2k
    m_c->Initialize(Context);
149
15.2k
  }
150
151
228k
  bool HandleTopLevelDecl(clang::DeclGroupRef D) override {
152
228k
    return m_c->HandleTopLevelDecl(D);
153
228k
  }
154
155
46
  void HandleInlineFunctionDefinition(clang::FunctionDecl *D) override {
156
46
    m_c->HandleInlineFunctionDefinition(D);
157
46
  }
158
159
420k
  void HandleInterestingDecl(clang::DeclGroupRef D) override {
160
420k
    m_c->HandleInterestingDecl(D);
161
420k
  }
162
163
15.2k
  void HandleTranslationUnit(clang::ASTContext &Ctx) override {
164
15.2k
    m_c->HandleTranslationUnit(Ctx);
165
15.2k
  }
166
167
66.7k
  void HandleTagDeclDefinition(clang::TagDecl *D) override {
168
66.7k
    m_c->HandleTagDeclDefinition(D);
169
66.7k
  }
170
171
75.1k
  void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override {
172
75.1k
    m_c->HandleTagDeclRequiredDefinition(D);
173
75.1k
  }
174
175
5.66k
  void HandleCXXImplicitFunctionInstantiation(clang::FunctionDecl *D) override {
176
5.66k
    m_c->HandleCXXImplicitFunctionInstantiation(D);
177
5.66k
  }
178
179
0
  void HandleTopLevelDeclInObjCContainer(clang::DeclGroupRef D) override {
180
0
    m_c->HandleTopLevelDeclInObjCContainer(D);
181
0
  }
182
183
0
  void HandleImplicitImportDecl(clang::ImportDecl *D) override {
184
0
    m_c->HandleImplicitImportDecl(D);
185
0
  }
186
187
0
  void CompleteTentativeDefinition(clang::VarDecl *D) override {
188
0
    m_c->CompleteTentativeDefinition(D);
189
0
  }
190
191
0
  void AssignInheritanceModel(clang::CXXRecordDecl *RD) override {
192
0
    m_c->AssignInheritanceModel(RD);
193
0
  }
194
195
30.8k
  void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override {
196
30.8k
    m_c->HandleCXXStaticMemberVarInstantiation(D);
197
30.8k
  }
198
199
0
  void HandleVTable(clang::CXXRecordDecl *RD) override {
200
0
    m_c->HandleVTable(RD);
201
0
  }
202
203
51.5k
  clang::ASTMutationListener *GetASTMutationListener() override {
204
51.5k
    return m_c->GetASTMutationListener();
205
51.5k
  }
206
207
789
  clang::ASTDeserializationListener *GetASTDeserializationListener() override {
208
789
    return m_c->GetASTDeserializationListener();
209
789
  }
210
211
  void PrintStats() override;
212
213
15.2k
  void InitializeSema(clang::Sema &S) override {
214
15.2k
    if (m_sc)
215
11.8k
      m_sc->InitializeSema(S);
216
15.2k
  }
217
218
  /// Inform the semantic consumer that Sema is no longer available.
219
15.2k
  void ForgetSema() override {
220
15.2k
    if (m_sc)
221
11.8k
      m_sc->ForgetSema();
222
15.2k
  }
223
224
74
  bool shouldSkipFunctionBody(clang::Decl *D) override {
225
74
    return m_c->shouldSkipFunctionBody(D);
226
74
  }
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
789
                           clang::ExternalSemaSource &low_quality_source) {
254
789
    Sources.push_back(&high_quality_source);
255
789
    Sources.push_back(&low_quality_source);
256
789
  }
257
258
  ~SemaSourceWithPriorities() override;
259
260
0
  void addSource(clang::ExternalSemaSource &source) {
261
0
    Sources.push_back(&source);
262
0
  }
263
264
  //===--------------------------------------------------------------------===//
265
  // ExternalASTSource.
266
  //===--------------------------------------------------------------------===//
267
268
888k
  clang::Decl *GetExternalDecl(uint32_t ID) override {
269
888k
    for (size_t i = 0; i < Sources.size(); 
++i0
)
270
888k
      if (clang::Decl *Result = Sources[i]->GetExternalDecl(ID))
271
888k
        return Result;
272
0
    return nullptr;
273
888k
  }
274
275
1.89M
  void CompleteRedeclChain(const clang::Decl *D) override {
276
5.69M
    for (size_t i = 0; i < Sources.size(); 
++i3.79M
)
277
3.79M
      Sources[i]->CompleteRedeclChain(D);
278
1.89M
  }
279
280
0
  clang::Selector GetExternalSelector(uint32_t ID) override {
281
0
    clang::Selector Sel;
282
0
    for (size_t i = 0; i < Sources.size(); ++i) {
283
0
      Sel = Sources[i]->GetExternalSelector(ID);
284
0
      if (!Sel.isNull())
285
0
        return Sel;
286
0
    }
287
0
    return Sel;
288
0
  }
289
290
0
  uint32_t GetNumExternalSelectors() override {
291
0
    for (size_t i = 0; i < Sources.size(); ++i)
292
0
      if (uint32_t total = Sources[i]->GetNumExternalSelectors())
293
0
        return total;
294
0
    return 0;
295
0
  }
296
297
184k
  clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
298
184k
    for (size_t i = 0; i < Sources.size(); 
++i0
)
299
184k
      if (clang::Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
300
184k
        return Result;
301
0
    return nullptr;
302
184k
  }
303
304
  clang::CXXBaseSpecifier *
305
30.8k
  GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
306
30.8k
    for (size_t i = 0; i < Sources.size(); 
++i0
)
307
30.8k
      if (clang::CXXBaseSpecifier *R =
308
30.8k
              Sources[i]->GetExternalCXXBaseSpecifiers(Offset))
309
30.8k
        return R;
310
0
    return nullptr;
311
30.8k
  }
312
313
  clang::CXXCtorInitializer **
314
24.3k
  GetExternalCXXCtorInitializers(uint64_t Offset) override {
315
24.3k
    for (auto *S : Sources)
316
24.3k
      if (auto *R = S->GetExternalCXXCtorInitializers(Offset))
317
24.3k
        return R;
318
0
    return nullptr;
319
24.3k
  }
320
321
3.93M
  ExtKind hasExternalDefinitions(const clang::Decl *D) override {
322
3.93M
    for (const auto &S : Sources)
323
7.87M
      if (auto EK = S->hasExternalDefinitions(D))
324
7.87M
        if (EK != EK_ReplyHazy)
325
0
          return EK;
326
3.93M
    return EK_ReplyHazy;
327
3.93M
  }
328
329
  bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
330
451k
                                      clang::DeclarationName Name) override {
331
523k
    for (size_t i = 0; i < Sources.size(); 
++i72.0k
)
332
488k
      if (Sources[i]->FindExternalVisibleDeclsByName(DC, Name))
333
416k
        return true;
334
34.7k
    return false;
335
451k
  }
336
337
0
  void completeVisibleDeclsMap(const clang::DeclContext *DC) override {
338
    // FIXME: Only one source should be able to complete the decls map.
339
0
    for (size_t i = 0; i < Sources.size(); ++i)
340
0
      Sources[i]->completeVisibleDeclsMap(DC);
341
0
  }
342
343
  void FindExternalLexicalDecls(
344
      const clang::DeclContext *DC,
345
      llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
346
76.3k
      llvm::SmallVectorImpl<clang::Decl *> &Result) override {
347
84.0k
    for (size_t i = 0; i < Sources.size(); 
++i7.72k
) {
348
80.1k
      Sources[i]->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
349
80.1k
      if (!Result.empty())
350
72.4k
        return;
351
80.1k
    }
352
76.3k
  }
353
354
  void
355
  FindFileRegionDecls(clang::FileID File, unsigned Offset, unsigned Length,
356
0
                      llvm::SmallVectorImpl<clang::Decl *> &Decls) override {
357
0
    for (size_t i = 0; i < Sources.size(); ++i)
358
0
      Sources[i]->FindFileRegionDecls(File, Offset, Length, Decls);
359
0
  }
360
361
38.8k
  void CompleteType(clang::TagDecl *Tag) override {
362
39.0k
    for (clang::ExternalSemaSource *S : Sources) {
363
39.0k
      S->CompleteType(Tag);
364
      // Stop after the first source completed the type.
365
39.0k
      if (Tag->isCompleteDefinition())
366
38.7k
        break;
367
39.0k
    }
368
38.8k
  }
369
370
0
  void CompleteType(clang::ObjCInterfaceDecl *Class) override {
371
0
    for (size_t i = 0; i < Sources.size(); ++i)
372
0
      Sources[i]->CompleteType(Class);
373
0
  }
374
375
0
  void ReadComments() override {
376
0
    for (size_t i = 0; i < Sources.size(); ++i)
377
0
      Sources[i]->ReadComments();
378
0
  }
379
380
76.3k
  void StartedDeserializing() override {
381
228k
    for (size_t i = 0; i < Sources.size(); 
++i152k
)
382
152k
      Sources[i]->StartedDeserializing();
383
76.3k
  }
384
385
76.3k
  void FinishedDeserializing() override {
386
228k
    for (size_t i = 0; i < Sources.size(); 
++i152k
)
387
152k
      Sources[i]->FinishedDeserializing();
388
76.3k
  }
389
390
789
  void StartTranslationUnit(clang::ASTConsumer *Consumer) override {
391
2.36k
    for (size_t i = 0; i < Sources.size(); 
++i1.57k
)
392
1.57k
      Sources[i]->StartTranslationUnit(Consumer);
393
789
  }
394
395
  void PrintStats() override;
396
397
1.18M
  clang::Module *getModule(unsigned ID) override {
398
1.18M
    for (size_t i = 0; i < Sources.size(); 
++i0
)
399
1.18M
      if (auto M = Sources[i]->getModule(ID))
400
1.18M
        return M;
401
0
    return nullptr;
402
1.18M
  }
403
404
  bool layoutRecordType(
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
7.53k
          &VirtualBaseOffsets) override {
411
22.2k
    for (size_t i = 0; i < Sources.size(); 
++i14.6k
)
412
15.0k
      if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
413
15.0k
                                       BaseOffsets, VirtualBaseOffsets))
414
393
        return true;
415
7.14k
    return false;
416
7.53k
  }
417
418
0
  void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override {
419
0
    for (auto &Source : Sources)
420
0
      Source->getMemoryBufferSizes(sizes);
421
0
  }
422
423
  //===--------------------------------------------------------------------===//
424
  // ExternalSemaSource.
425
  //===--------------------------------------------------------------------===//
426
427
789
  void InitializeSema(clang::Sema &S) override {
428
789
    for (auto &Source : Sources)
429
1.57k
      Source->InitializeSema(S);
430
789
  }
431
432
789
  void ForgetSema() override {
433
789
    for (auto &Source : Sources)
434
1.57k
      Source->ForgetSema();
435
789
  }
436
437
0
  void ReadMethodPool(clang::Selector Sel) override {
438
0
    for (auto &Source : Sources)
439
0
      Source->ReadMethodPool(Sel);
440
0
  }
441
442
0
  void updateOutOfDateSelector(clang::Selector Sel) override {
443
0
    for (auto &Source : Sources)
444
0
      Source->updateOutOfDateSelector(Sel);
445
0
  }
446
447
  void ReadKnownNamespaces(
448
0
      llvm::SmallVectorImpl<clang::NamespaceDecl *> &Namespaces) override {
449
0
    for (auto &Source : Sources)
450
0
      Source->ReadKnownNamespaces(Namespaces);
451
0
  }
452
453
  void ReadUndefinedButUsed(
454
      llvm::MapVector<clang::NamedDecl *, clang::SourceLocation> &Undefined)
455
0
      override {
456
0
    for (auto &Source : Sources)
457
0
      Source->ReadUndefinedButUsed(Undefined);
458
0
  }
459
460
  void ReadMismatchingDeleteExpressions(
461
      llvm::MapVector<clang::FieldDecl *,
462
                      llvm::SmallVector<std::pair<clang::SourceLocation, bool>,
463
0
                                        4>> &Exprs) override {
464
0
    for (auto &Source : Sources)
465
0
      Source->ReadMismatchingDeleteExpressions(Exprs);
466
0
  }
467
468
0
  bool LookupUnqualified(clang::LookupResult &R, clang::Scope *S) override {
469
0
    for (auto &Source : Sources) {
470
0
      Source->LookupUnqualified(R, S);
471
0
      if (!R.empty())
472
0
        break;
473
0
    }
474
475
0
    return !R.empty();
476
0
  }
477
478
  void ReadTentativeDefinitions(
479
0
      llvm::SmallVectorImpl<clang::VarDecl *> &Defs) override {
480
0
    for (auto &Source : Sources)
481
0
      Source->ReadTentativeDefinitions(Defs);
482
0
  }
483
484
  void ReadUnusedFileScopedDecls(
485
0
      llvm::SmallVectorImpl<const clang::DeclaratorDecl *> &Decls) override {
486
0
    for (auto &Source : Sources)
487
0
      Source->ReadUnusedFileScopedDecls(Decls);
488
0
  }
489
490
  void ReadDelegatingConstructors(
491
0
      llvm::SmallVectorImpl<clang::CXXConstructorDecl *> &Decls) override {
492
0
    for (auto &Source : Sources)
493
0
      Source->ReadDelegatingConstructors(Decls);
494
0
  }
495
496
  void ReadExtVectorDecls(
497
0
      llvm::SmallVectorImpl<clang::TypedefNameDecl *> &Decls) override {
498
0
    for (auto &Source : Sources)
499
0
      Source->ReadExtVectorDecls(Decls);
500
0
  }
501
502
  void ReadUnusedLocalTypedefNameCandidates(
503
0
      llvm::SmallSetVector<const clang::TypedefNameDecl *, 4> &Decls) override {
504
0
    for (auto &Source : Sources)
505
0
      Source->ReadUnusedLocalTypedefNameCandidates(Decls);
506
0
  }
507
508
  void ReadReferencedSelectors(
509
      llvm::SmallVectorImpl<std::pair<clang::Selector, clang::SourceLocation>>
510
0
          &Sels) override {
511
0
    for (auto &Source : Sources)
512
0
      Source->ReadReferencedSelectors(Sels);
513
0
  }
514
515
  void ReadWeakUndeclaredIdentifiers(
516
      llvm::SmallVectorImpl<std::pair<clang::IdentifierInfo *, clang::WeakInfo>>
517
0
          &WI) override {
518
0
    for (auto &Source : Sources)
519
0
      Source->ReadWeakUndeclaredIdentifiers(WI);
520
0
  }
521
522
  void ReadUsedVTables(
523
0
      llvm::SmallVectorImpl<clang::ExternalVTableUse> &VTables) override {
524
0
    for (auto &Source : Sources)
525
0
      Source->ReadUsedVTables(VTables);
526
0
  }
527
528
  void ReadPendingInstantiations(
529
      llvm::SmallVectorImpl<
530
          std::pair<clang::ValueDecl *, clang::SourceLocation>> &Pending)
531
0
      override {
532
0
    for (auto &Source : Sources)
533
0
      Source->ReadPendingInstantiations(Pending);
534
0
  }
535
536
  void ReadLateParsedTemplates(
537
      llvm::MapVector<const clang::FunctionDecl *,
538
                      std::unique_ptr<clang::LateParsedTemplate>> &LPTMap)
539
0
      override {
540
0
    for (auto &Source : Sources)
541
0
      Source->ReadLateParsedTemplates(LPTMap);
542
0
  }
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
0
              const clang::ObjCObjectPointerType *OPT) override {
550
0
    for (auto &Source : Sources) {
551
0
      if (clang::TypoCorrection C =
552
0
              Source->CorrectTypo(Typo, LookupKind, S, SS, CCC,
553
0
                                      MemberContext, EnteringContext, OPT))
554
0
        return C;
555
0
    }
556
0
    return clang::TypoCorrection();
557
0
  }
558
559
  bool MaybeDiagnoseMissingCompleteType(clang::SourceLocation Loc,
560
0
                                        clang::QualType T) override {
561
0
    for (auto &Source : Sources) {
562
0
      if (Source->MaybeDiagnoseMissingCompleteType(Loc, T))
563
0
        return true;
564
0
    }
565
0
    return false;
566
0
  }
567
};
568
569
} // namespace lldb_private
570
#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H