clang 22.0.0git
ASTImporter.h
Go to the documentation of this file.
1//===- ASTImporter.h - Importing ASTs from other Contexts -------*- 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 ASTImporter class which imports AST nodes from one
10// context into another context.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_ASTIMPORTER_H
15#define LLVM_CLANG_AST_ASTIMPORTER_H
16
18#include "clang/AST/DeclBase.h"
20#include "clang/AST/ExprCXX.h"
23#include "clang/AST/Type.h"
26#include "clang/Basic/LLVM.h"
28#include "llvm/ADT/DenseMap.h"
29#include "llvm/ADT/DenseSet.h"
30#include "llvm/ADT/SmallVector.h"
31#include <optional>
32#include <utility>
33
34namespace clang {
35
36class ASTContext;
38class Attr;
41class Decl;
42class DeclContext;
43class Expr;
44class FileManager;
45class NamedDecl;
46class Stmt;
47class TagDecl;
49class TypeSourceInfo;
50
51 // \brief Returns with a list of declarations started from the canonical decl
52 // then followed by subsequent decls in the translation unit.
53 // This gives a canonical list for each entry in the redecl chain.
54 // `Decl::redecls()` gives a list of decls which always start from the
55 // previous decl and the next item is actually the previous item in the order
56 // of source locations. Thus, `Decl::redecls()` gives different lists for
57 // the different entries in a given redecl chain.
59
60 /// Imports selected nodes from one AST context into another context,
61 /// merging AST nodes where appropriate.
63 friend class ASTNodeImporter;
64 public:
66 llvm::DenseSet<std::tuple<Decl *, Decl *, int>>;
68 llvm::DenseMap<const CXXBaseSpecifier *, CXXBaseSpecifier *>;
69
71
72 // An ImportPath is the list of the AST nodes which we visit during an
73 // Import call.
74 // If node `A` depends on node `B` then the path contains an `A`->`B` edge.
75 // From the call stack of the import functions we can read the very same
76 // path.
77 //
78 // Now imagine the following AST, where the `->` represents dependency in
79 // therms of the import.
80 // ```
81 // A->B->C->D
82 // `->E
83 // ```
84 // We would like to import A.
85 // The import behaves like a DFS, so we will visit the nodes in this order:
86 // ABCDE.
87 // During the visitation we will have the following ImportPaths:
88 // ```
89 // A
90 // AB
91 // ABC
92 // ABCD
93 // ABC
94 // AB
95 // ABE
96 // AB
97 // A
98 // ```
99 // If during the visit of E there is an error then we set an error for E,
100 // then as the call stack shrinks for B, then for A:
101 // ```
102 // A
103 // AB
104 // ABC
105 // ABCD
106 // ABC
107 // AB
108 // ABE // Error! Set an error to E
109 // AB // Set an error to B
110 // A // Set an error to A
111 // ```
112 // However, during the import we could import C and D without any error and
113 // they are independent from A,B and E.
114 // We must not set up an error for C and D.
115 // So, at the end of the import we have an entry in `ImportDeclErrors` for
116 // A,B,E but not for C,D.
117 //
118 // Now what happens if there is a cycle in the import path?
119 // Let's consider this AST:
120 // ```
121 // A->B->C->A
122 // `->E
123 // ```
124 // During the visitation we will have the below ImportPaths and if during
125 // the visit of E there is an error then we will set up an error for E,B,A.
126 // But what's up with C?
127 // ```
128 // A
129 // AB
130 // ABC
131 // ABCA
132 // ABC
133 // AB
134 // ABE // Error! Set an error to E
135 // AB // Set an error to B
136 // A // Set an error to A
137 // ```
138 // This time we know that both B and C are dependent on A.
139 // This means we must set up an error for C too.
140 // As the call stack reverses back we get to A and we must set up an error
141 // to all nodes which depend on A (this includes C).
142 // But C is no longer on the import path, it just had been previously.
143 // Such situation can happen only if during the visitation we had a cycle.
144 // If we didn't have any cycle, then the normal way of passing an Error
145 // object through the call stack could handle the situation.
146 // This is why we must track cycles during the import process for each
147 // visited declaration.
149 public:
151
152 void push(Decl *D) {
153 Nodes.push_back(D);
154 ++Aux[D];
155 }
156
157 void pop() {
158 if (Nodes.empty())
159 return;
160 --Aux[Nodes.back()];
161 Nodes.pop_back();
162 }
163
164 /// Returns true if the last element can be found earlier in the path.
165 bool hasCycleAtBack() const {
166 auto Pos = Aux.find(Nodes.back());
167 return Pos != Aux.end() && Pos->second > 1;
168 }
169
170 using Cycle = llvm::iterator_range<VecTy::const_reverse_iterator>;
172 assert(Nodes.size() >= 2);
173 return Cycle(Nodes.rbegin(),
174 std::find(Nodes.rbegin() + 1, Nodes.rend(), Nodes.back()) +
175 1);
176 }
177
178 /// Returns the copy of the cycle.
180 auto R = getCycleAtBack();
181 return VecTy(R.begin(), R.end());
182 }
183
184 private:
185 // All nodes of the path.
186 VecTy Nodes;
187 // Auxiliary container to be able to answer "Do we have a cycle ending
188 // at last element?" as fast as possible.
189 // We count each Decl's occurrence over the path.
190 llvm::SmallDenseMap<Decl *, int, 32> Aux;
191 };
192
194 public:
196
197 bool isCycle(const FunctionDecl *D) const;
198
199 private:
200 llvm::DenseSet<const FunctionDecl *> FunctionDeclsWithImportInProgress;
201 };
202
203 private:
204 std::shared_ptr<ASTImporterSharedState> SharedState = nullptr;
205
206 /// The path which we go through during the import of a given AST node.
207 ImportPathTy ImportPath;
208 /// Sometimes we have to save some part of an import path, so later we can
209 /// set up properties to the saved nodes.
210 /// We may have several of these import paths associated to one Decl.
211 using SavedImportPathsForOneDecl =
213 using SavedImportPathsTy =
214 llvm::SmallDenseMap<Decl *, SavedImportPathsForOneDecl, 32>;
215 SavedImportPathsTy SavedImportPaths;
216
217 /// The contexts we're importing to and from.
218 ASTContext &ToContext, &FromContext;
219
220 /// The file managers we're importing to and from.
221 FileManager &ToFileManager, &FromFileManager;
222
223 /// Whether to perform a minimal import.
224 bool Minimal;
225
226 ODRHandlingType ODRHandling;
227
228 /// Whether the last diagnostic came from the "from" context.
229 bool LastDiagFromFrom = false;
230
231 /// Mapping from the already-imported types in the "from" context
232 /// to the corresponding types in the "to" context.
233 llvm::DenseMap<const Type *, const Type *> ImportedTypes;
234
235 /// Mapping from the already-imported declarations in the "from"
236 /// context to the corresponding declarations in the "to" context.
237 llvm::DenseMap<Decl *, Decl *> ImportedDecls;
238
239 /// Mapping from the already-imported declarations in the "from"
240 /// context to the error status of the import of that declaration.
241 /// This map contains only the declarations that were not correctly
242 /// imported. The same declaration may or may not be included in
243 /// ImportedDecls. This map is updated continuously during imports and never
244 /// cleared (like ImportedDecls).
245 llvm::DenseMap<Decl *, ASTImportError> ImportDeclErrors;
246
247 /// Mapping from the already-imported declarations in the "to"
248 /// context to the corresponding declarations in the "from" context.
249 llvm::DenseMap<Decl *, Decl *> ImportedFromDecls;
250
251 /// Mapping from the already-imported statements in the "from"
252 /// context to the corresponding statements in the "to" context.
253 llvm::DenseMap<Stmt *, Stmt *> ImportedStmts;
254
255 /// Mapping from the already-imported FileIDs in the "from" source
256 /// manager to the corresponding FileIDs in the "to" source manager.
257 llvm::DenseMap<FileID, FileID> ImportedFileIDs;
258
259 /// Mapping from the already-imported CXXBasesSpecifier in
260 /// the "from" source manager to the corresponding CXXBasesSpecifier
261 /// in the "to" source manager.
262 ImportedCXXBaseSpecifierMap ImportedCXXBaseSpecifiers;
263
264 /// Declaration (from, to) pairs that are known not to be equivalent
265 /// (which we have already complained about).
266 NonEquivalentDeclSet NonEquivalentDecls;
267 /// A FunctionDecl can have properties that have a reference to the
268 /// function itself and are imported before the function is created. This
269 /// can come for example from auto return type or when template parameters
270 /// are used in the return type or parameters. This member is used to detect
271 /// cyclic import of FunctionDecl objects to avoid infinite recursion.
272 FunctionDeclImportCycleDetector FindFunctionDeclImportCycle;
273
274 using FoundDeclsTy = SmallVector<NamedDecl *, 2>;
275 FoundDeclsTy findDeclsInToCtx(DeclContext *DC, DeclarationName Name);
276
277 void AddToLookupTable(Decl *ToD);
278
279 protected:
280 /// Can be overwritten by subclasses to implement their own import logic.
281 /// The overwritten method should call this method if it didn't import the
282 /// decl on its own.
283 virtual Expected<Decl *> ImportImpl(Decl *From);
284
285 /// Used only in unittests to verify the behaviour of the error handling.
286 virtual bool returnWithErrorInTest() { return false; };
287
288 public:
289
290 /// \param ToContext The context we'll be importing into.
291 ///
292 /// \param ToFileManager The file manager we'll be importing into.
293 ///
294 /// \param FromContext The context we'll be importing from.
295 ///
296 /// \param FromFileManager The file manager we'll be importing into.
297 ///
298 /// \param MinimalImport If true, the importer will attempt to import
299 /// as little as it can, e.g., by importing declarations as forward
300 /// declarations that can be completed at a later point.
301 ///
302 /// \param SharedState The importer specific lookup table which may be
303 /// shared amongst several ASTImporter objects.
304 /// If not set then the original C/C++ lookup is used.
305 ASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
306 ASTContext &FromContext, FileManager &FromFileManager,
307 bool MinimalImport,
308 std::shared_ptr<ASTImporterSharedState> SharedState = nullptr);
309
310 virtual ~ASTImporter();
311
312 /// Whether the importer will perform a minimal import, creating
313 /// to-be-completed forward declarations when possible.
314 bool isMinimalImport() const { return Minimal; }
315
316 void setODRHandling(ODRHandlingType T) { ODRHandling = T; }
317
318 /// \brief Import the given object, returns the result.
319 ///
320 /// \param To Import the object into this variable.
321 /// \param From Object to import.
322 /// \return Error information (success or error).
323 template <typename ImportT>
324 [[nodiscard]] llvm::Error importInto(ImportT &To, const ImportT &From) {
325 auto ToOrErr = Import(From);
326 if (ToOrErr)
327 To = *ToOrErr;
328 return ToOrErr.takeError();
329 }
330
331 /// Import cleanup objects owned by ExprWithCleanup.
334
335 /// Import the given type from the "from" context into the "to"
336 /// context.
337 ///
338 /// \returns The equivalent type in the "to" context, or the import error.
340
341 /// Import the given qualified type from the "from" context into the "to"
342 /// context. A null type is imported as a null type (no error).
343 ///
344 /// \returns The equivalent type in the "to" context, or the import error.
346
347 /// Import the given type source information from the
348 /// "from" context into the "to" context.
349 ///
350 /// \returns The equivalent type source information in the "to"
351 /// context, or the import error.
353
354 /// Import the given attribute from the "from" context into the
355 /// "to" context.
356 ///
357 /// \returns The equivalent attribute in the "to" context, or the import
358 /// error.
359 llvm::Expected<Attr *> Import(const Attr *FromAttr);
360
361 /// Import the given declaration from the "from" context into the
362 /// "to" context.
363 ///
364 /// \returns The equivalent declaration in the "to" context, or the import
365 /// error.
368 return Import(const_cast<Decl *>(FromD));
369 }
370
372 Import(const InheritedConstructor &From);
373
374 /// Return the copy of the given declaration in the "to" context if
375 /// it has already been imported from the "from" context. Otherwise return
376 /// nullptr.
377 Decl *GetAlreadyImportedOrNull(const Decl *FromD) const;
378
379 /// Return the translation unit from where the declaration was
380 /// imported. If it does not exist nullptr is returned.
382
383 /// Return the declaration in the "from" context from which the declaration
384 /// in the "to" context was imported. If it was not imported or of the wrong
385 /// type a null value is returned.
386 template <typename DeclT>
387 std::optional<DeclT *> getImportedFromDecl(const DeclT *ToD) const {
388 auto FromI = ImportedFromDecls.find(ToD);
389 if (FromI == ImportedFromDecls.end())
390 return {};
391 auto *FromD = dyn_cast<DeclT>(FromI->second);
392 if (!FromD)
393 return {};
394 return FromD;
395 }
396
397 /// Import the given declaration context from the "from"
398 /// AST context into the "to" AST context.
399 ///
400 /// \returns the equivalent declaration context in the "to"
401 /// context, or error value.
403
404 /// Import the given expression from the "from" context into the
405 /// "to" context.
406 ///
407 /// \returns The equivalent expression in the "to" context, or the import
408 /// error.
410
411 /// Import the given statement from the "from" context into the
412 /// "to" context.
413 ///
414 /// \returns The equivalent statement in the "to" context, or the import
415 /// error.
417
418 /// Import the given nested-name-specifier from the "from"
419 /// context into the "to" context.
420 ///
421 /// \returns The equivalent nested-name-specifier in the "to"
422 /// context, or the import error.
424
425 /// Import the given nested-name-specifier-loc from the "from"
426 /// context into the "to" context.
427 ///
428 /// \returns The equivalent nested-name-specifier-loc in the "to"
429 /// context, or the import error.
432
433 /// Import the given template name from the "from" context into the
434 /// "to" context, or the import error.
436
437 /// Import the given source location from the "from" context into
438 /// the "to" context.
439 ///
440 /// \returns The equivalent source location in the "to" context, or the
441 /// import error.
443
444 /// Import the given source range from the "from" context into
445 /// the "to" context.
446 ///
447 /// \returns The equivalent source range in the "to" context, or the import
448 /// error.
450
451 /// Import the given declaration name from the "from"
452 /// context into the "to" context.
453 ///
454 /// \returns The equivalent declaration name in the "to" context, or the
455 /// import error.
457
458 /// Import the given identifier from the "from" context
459 /// into the "to" context.
460 ///
461 /// \returns The equivalent identifier in the "to" context. Note: It
462 /// returns nullptr only if the FromId was nullptr.
463 IdentifierInfo *Import(const IdentifierInfo *FromId);
464
465 /// Import the given identifier or overloaded operator from the "from"
466 /// context into the "to" context.
467 ///
468 /// \returns The equivalent identifier or overloaded operator in the "to"
469 /// context.
472
473 /// Import the given Objective-C selector from the "from"
474 /// context into the "to" context.
475 ///
476 /// \returns The equivalent selector in the "to" context, or the import
477 /// error.
479
480 /// Import the given file ID from the "from" context into the
481 /// "to" context.
482 ///
483 /// \returns The equivalent file ID in the source manager of the "to"
484 /// context, or the import error.
485 llvm::Expected<FileID> Import(FileID, bool IsBuiltin = false);
486
487 /// Import the given C++ constructor initializer from the "from"
488 /// context into the "to" context.
489 ///
490 /// \returns The equivalent initializer in the "to" context, or the import
491 /// error.
493
494 /// Import the given CXXBaseSpecifier from the "from" context into
495 /// the "to" context.
496 ///
497 /// \returns The equivalent CXXBaseSpecifier in the source manager of the
498 /// "to" context, or the import error.
500
501 /// Import the given APValue from the "from" context into
502 /// the "to" context.
503 ///
504 /// \return the equivalent APValue in the "to" context or the import
505 /// error.
506 llvm::Expected<APValue> Import(const APValue &FromValue);
507
508 /// Import the definition of the given declaration, including all of
509 /// the declarations it contains.
510 [[nodiscard]] llvm::Error ImportDefinition(Decl *From);
511
512 llvm::Error
516
517 /// Cope with a name conflict when importing a declaration into the
518 /// given context.
519 ///
520 /// This routine is invoked whenever there is a name conflict while
521 /// importing a declaration. The returned name will become the name of the
522 /// imported declaration. By default, the returned name is the same as the
523 /// original name, leaving the conflict unresolve such that name lookup
524 /// for this name is likely to find an ambiguity later.
525 ///
526 /// Subclasses may override this routine to resolve the conflict, e.g., by
527 /// renaming the declaration being imported.
528 ///
529 /// \param Name the name of the declaration being imported, which conflicts
530 /// with other declarations.
531 ///
532 /// \param DC the declaration context (in the "to" AST context) in which
533 /// the name is being imported.
534 ///
535 /// \param IDNS the identifier namespace in which the name will be found.
536 ///
537 /// \param Decls the set of declarations with the same name as the
538 /// declaration being imported.
539 ///
540 /// \param NumDecls the number of conflicting declarations in \p Decls.
541 ///
542 /// \returns the name that the newly-imported declaration should have. Or
543 /// an error if we can't handle the name conflict.
545 HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS,
546 NamedDecl **Decls, unsigned NumDecls);
547
548 /// Retrieve the context that AST nodes are being imported into.
549 ASTContext &getToContext() const { return ToContext; }
550
551 /// Retrieve the context that AST nodes are being imported from.
552 ASTContext &getFromContext() const { return FromContext; }
553
554 /// Retrieve the file manager that AST nodes are being imported into.
555 FileManager &getToFileManager() const { return ToFileManager; }
556
557 /// Retrieve the file manager that AST nodes are being imported from.
558 FileManager &getFromFileManager() const { return FromFileManager; }
559
560 /// Report a diagnostic in the "to" context.
561 DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID);
562
563 /// Report a diagnostic in the "from" context.
564 DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID);
565
566 /// Return the set of declarations that we know are not equivalent.
567 NonEquivalentDeclSet &getNonEquivalentDecls() { return NonEquivalentDecls; }
568
569 /// Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
570 /// Mark the Decl as complete, filling it in as much as possible.
571 ///
572 /// \param D A declaration in the "to" context.
573 virtual void CompleteDecl(Decl* D);
574
575 /// Subclasses can override this function to observe all of the \c From ->
576 /// \c To declaration mappings as they are imported.
577 virtual void Imported(Decl *From, Decl *To) {}
578
579 void RegisterImportedDecl(Decl *FromD, Decl *ToD);
580
581 /// Store and assign the imported declaration to its counterpart.
582 /// It may happen that several decls from the 'from' context are mapped to
583 /// the same decl in the 'to' context.
584 Decl *MapImported(Decl *From, Decl *To);
585
586 /// Called by StructuralEquivalenceContext. If a RecordDecl is
587 /// being compared to another RecordDecl as part of import, completing the
588 /// other RecordDecl may trigger importation of the first RecordDecl. This
589 /// happens especially for anonymous structs. If the original of the second
590 /// RecordDecl can be found, we can complete it without the need for
591 /// importation, eliminating this loop.
592 virtual Decl *GetOriginalDecl(Decl *To) { return nullptr; }
593
594 /// Return if import of the given declaration has failed and if yes
595 /// the kind of the problem. This gives the first error encountered with
596 /// the node.
597 std::optional<ASTImportError> getImportDeclErrorIfAny(Decl *FromD) const;
598
599 /// Mark (newly) imported declaration with error.
601
602 /// Determine whether the given types are structurally
603 /// equivalent.
605 bool Complain = true);
606
607 /// Determine the index of a field in its parent record.
608 /// F should be a field (or indirect field) declaration.
609 /// \returns The index of the field in its parent context (starting from 0).
610 /// On error `std::nullopt` is returned (parent context is non-record).
612 };
613
614} // namespace clang
615
616#endif // LLVM_CLANG_AST_ASTIMPORTER_H
Defines the Diagnostic-related interfaces.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
Importer specific state, which may be shared amongst several ASTImporter objects.
bool hasCycleAtBack() const
Returns true if the last element can be found earlier in the path.
llvm::iterator_range< VecTy::const_reverse_iterator > Cycle
VecTy copyCycleAtBack() const
Returns the copy of the cycle.
llvm::SmallVector< Decl *, 32 > VecTy
ASTContext & getFromContext() const
Retrieve the context that AST nodes are being imported from.
NonEquivalentDeclSet & getNonEquivalentDecls()
Return the set of declarations that we know are not equivalent.
ASTContext & getToContext() const
Retrieve the context that AST nodes are being imported into.
llvm::Expected< const Decl * > Import(const Decl *FromD)
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "to" context.
Decl * MapImported(Decl *From, Decl *To)
Store and assign the imported declaration to its counterpart.
static UnsignedOrNone getFieldIndex(Decl *F)
Determine the index of a field in its parent record.
TranslationUnitDecl * GetFromTU(Decl *ToD)
Return the translation unit from where the declaration was imported.
llvm::Expected< DeclContext * > ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context.
llvm::Error ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains.
virtual Expected< DeclarationName > HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS, NamedDecl **Decls, unsigned NumDecls)
Cope with a name conflict when importing a declaration into the given context.
virtual bool returnWithErrorInTest()
Used only in unittests to verify the behaviour of the error handling.
std::optional< DeclT * > getImportedFromDecl(const DeclT *ToD) const
Return the declaration in the "from" context from which the declaration in the "to" context was impor...
void RegisterImportedDecl(Decl *FromD, Decl *ToD)
std::optional< ASTImportError > getImportDeclErrorIfAny(Decl *FromD) const
Return if import of the given declaration has failed and if yes the kind of the problem.
friend class ASTNodeImporter
Definition ASTImporter.h:63
llvm::Error ImportTemplateArguments(ArrayRef< TemplateArgument > FromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
FileManager & getToFileManager() const
Retrieve the file manager that AST nodes are being imported into.
llvm::Error importInto(ImportT &To, const ImportT &From)
Import the given object, returns the result.
virtual Decl * GetOriginalDecl(Decl *To)
Called by StructuralEquivalenceContext.
void setODRHandling(ODRHandlingType T)
virtual void Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "from" context.
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
Definition ASTImporter.h:65
virtual ~ASTImporter()
bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain=true)
Determine whether the given types are structurally equivalent.
virtual Expected< Decl * > ImportImpl(Decl *From)
Can be overwritten by subclasses to implement their own import logic.
bool isMinimalImport() const
Whether the importer will perform a minimal import, creating to-be-completed forward declarations whe...
FileManager & getFromFileManager() const
Retrieve the file manager that AST nodes are being imported from.
Expected< TemplateArgument > Import(const TemplateArgument &From)
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, std::shared_ptr< ASTImporterSharedState > SharedState=nullptr)
llvm::Expected< ExprWithCleanups::CleanupObject > Import(ExprWithCleanups::CleanupObject From)
Import cleanup objects owned by ExprWithCleanup.
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
Decl * GetAlreadyImportedOrNull(const Decl *FromD) const
Return the copy of the given declaration in the "to" context if it has already been imported from the...
void setImportDeclError(Decl *From, ASTImportError Error)
Mark (newly) imported declaration with error.
llvm::DenseMap< const CXXBaseSpecifier *, CXXBaseSpecifier * > ImportedCXXBaseSpecifierMap
Definition ASTImporter.h:67
Attr - This represents one attribute.
Definition Attr.h:45
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a C++ base or member initializer.
Definition DeclCXX.h:2369
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1449
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
The name of a declaration.
A little helper class used to produce diagnostics.
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
Definition ExprCXX.h:3667
This represents one expression.
Definition Expr.h:112
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
Definition FileManager.h:53
Represents a function declaration or definition.
Definition Decl.h:2000
One of these records is kept for each identifier that is lexed.
Description of a constructor that was inherited from a base class.
Definition DeclCXX.h:2575
This represents a decl that may have a name.
Definition Decl.h:274
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
A (possibly-)qualified type.
Definition TypeBase.h:937
Smart pointer class that efficiently represents Objective-C method names.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition Stmt.h:85
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3717
Represents a template argument.
Represents a C++ template name within the type system.
The top declaration context.
Definition Decl.h:105
A container of type source information.
Definition TypeBase.h:8249
The base class of the type hierarchy.
Definition TypeBase.h:1833
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
llvm::SmallVector< Decl *, 2 > getCanonicalForwardRedeclChain(Decl *D)