clang: lib/AST/ExternalASTSource.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

21#include "llvm/Support/ErrorHandling.h"

22#include

23#include

24

25using namespace clang;

26

27char ExternalASTSource::ID;

28

30

31std::optional

33 return std::nullopt;

34}

35

39}

40

42 unsigned Length,

44

46

48

50

52

54

56

58

60

62 const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,

63 llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,

64 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,

65 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) {

66 return false;

67}

68

70

73}

74

76 return 0;

77}

78

80 return nullptr;

81}

82

85 return nullptr;

86}

87

90 return nullptr;

91}

92

96 return false;

97}

98

100 return false;

101}

102

105 return false;

106}

107

109

113

115

117 uint32_t OldGeneration = CurrentGeneration;

118

119

120

121 auto *P = C.getExternalSource();

122 if (P && P != this)

123 CurrentGeneration = P->incrementGeneration(C);

124 else {

125

126

127 if (!++CurrentGeneration)

128 llvm::report_fatal_error("generation counter overflowed", false);

129 }

130

131 return OldGeneration;

132}

Defines the clang::ASTContext interface.

Defines the clang::ASTSourceDescriptor class, which abstracts clang modules and precompiled header fi...

Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

llvm::MachO::Record Record

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

Represents a base class of a C++ class.

Represents a C++ base or member initializer.

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

Decl - This represents one declaration (or definition), e.g.

Kind

Lists the kind of concrete classes of Decl.

The name of a declaration.

virtual ExtKind hasExternalDefinitions(const Decl *D)

virtual void StartTranslationUnit(ASTConsumer *Consumer)

Function that will be invoked when we begin parsing a new translation unit involving this external AS...

virtual std::optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID)

Return a descriptor for the corresponding module, if one exists.

MemoryBufferSizes getMemoryBufferSizes() const

Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...

uint32_t incrementGeneration(ASTContext &C)

Increment the current generation.

virtual CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset)

Resolve the offset of a set of C++ constructor initializers in the decl stream into an array of initi...

virtual void FinishedDeserializing()

Notify ExternalASTSource that we finished the deserialization of a decl or type.

virtual Selector GetExternalSelector(uint32_t ID)

Resolve a selector ID into a selector.

virtual uint32_t GetNumExternalSelectors()

Returns the number of selectors known to the external AST source.

virtual ~ExternalASTSource()

virtual void ReadComments()

Loads comment ranges.

virtual void CompleteRedeclChain(const Decl *D)

Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.

virtual void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls)

Get the decls that are contained in a file in the Offset/Length range.

virtual bool LoadExternalSpecializations(const Decl *D, bool OnlyPartial)

Load all the external specializations for the Decl.

virtual Decl * GetExternalDecl(GlobalDeclID ID)

Resolve a declaration ID into a declaration, potentially building a new declaration.

virtual void PrintStats()

Print any statistics that have been gathered regarding the external AST source.

virtual Stmt * GetExternalDeclStmt(uint64_t Offset)

Resolve the offset of a statement in the decl stream into a statement.

virtual void StartedDeserializing()

Notify ExternalASTSource that we started deserialization of a decl or type so until FinishedDeseriali...

virtual CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset)

Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.

virtual bool layoutRecordType(const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &BaseOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &VirtualBaseOffsets)

Perform layout on the given record.

virtual bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC)

Find all declarations with the given name in the given context, and add them to the context by callin...

virtual void CompleteType(TagDecl *Tag)

Gives the external AST source an opportunity to complete an incomplete type.

virtual void completeVisibleDeclsMap(const DeclContext *DC)

Ensures that the table of all visible declarations inside this context is up to date.

virtual void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Result)

Finds all declarations lexically contained within the given DeclContext, after applying an optional f...

An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...

Represents an ObjC class declaration.

Represents a struct/union/class.

Smart pointer class that efficiently represents Objective-C method names.

Stmt - This represents one statement.

Represents the declaration of a struct/union/class/enum.

The JSON file list parser is used to communicate input to InstallAPI.

@ Result

The result type of a method or function.

@ Class

The "class" keyword introduces the elaborated-type-specifier.