clang: lib/Sema/MultiplexExternalSemaSource.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

14

15using namespace clang;

16

17char MultiplexExternalSemaSource::ID;

18

19

20

21

24 S1->Retain();

25 S2->Retain();

26 Sources.push_back(S1);

27 Sources.push_back(S2);

28}

29

30

32 for (auto *S : Sources)

33 S->Release();

34}

35

36

37

38

39

41 Source->Retain();

42 Sources.push_back(Source);

43}

44

45

46

47

48

50 for(size_t i = 0; i < Sources.size(); ++i)

53 return nullptr;

54}

55

57 for (size_t i = 0; i < Sources.size(); ++i)

59}

60

63 for(size_t i = 0; i < Sources.size(); ++i) {

64 Sel = Sources[i]->GetExternalSelector(ID);

66 return Sel;

67 }

68 return Sel;

69}

70

72 uint32_t total = 0;

73 for(size_t i = 0; i < Sources.size(); ++i)

75 return total;

76}

77

79 for(size_t i = 0; i < Sources.size(); ++i)

82 return nullptr;

83}

84

86 uint64_t Offset){

87 for(size_t i = 0; i < Sources.size(); ++i)

89 return R;

90 return nullptr;

91}

92

95 for (auto *S : Sources)

96 if (auto *R = S->GetExternalCXXCtorInitializers(Offset))

97 return R;

98 return nullptr;

99}

100

103 for (const auto &S : Sources)

104 if (auto EK = S->hasExternalDefinitions(D))

106 return EK;

108}

109

113 bool AnyDeclsFound = false;

114 for (size_t i = 0; i < Sources.size(); ++i)

115 AnyDeclsFound |=

117 return AnyDeclsFound;

118}

119

121 const Decl *D, bool OnlyPartial) {

122 bool Loaded = false;

123 for (size_t i = 0; i < Sources.size(); ++i)

125 return Loaded;

126}

127

130 bool AnyNewSpecsLoaded = false;

131 for (size_t i = 0; i < Sources.size(); ++i)

132 AnyNewSpecsLoaded |=

134 return AnyNewSpecsLoaded;

135}

136

138 for(size_t i = 0; i < Sources.size(); ++i)

140}

141

145 for(size_t i = 0; i < Sources.size(); ++i)

147}

148

150 unsigned Offset,

151 unsigned Length,

153 for(size_t i = 0; i < Sources.size(); ++i)

155}

156

158 for(size_t i = 0; i < Sources.size(); ++i)

160}

161

163 for(size_t i = 0; i < Sources.size(); ++i)

165}

166

168 for(size_t i = 0; i < Sources.size(); ++i)

170}

171

173 for(size_t i = 0; i < Sources.size(); ++i)

175}

176

178 for(size_t i = 0; i < Sources.size(); ++i)

180}

181

183 for(size_t i = 0; i < Sources.size(); ++i)

185}

186

188 for(size_t i = 0; i < Sources.size(); ++i)

190}

191

193 for (size_t i = 0; i < Sources.size(); ++i)

194 if (auto M = Sources[i]->getModule(ID))

195 return M;

196 return nullptr;

197}

198

200 uint64_t &Size,

201 uint64_t &Alignment,

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

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

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

205 for(size_t i = 0; i < Sources.size(); ++i)

207 BaseOffsets, VirtualBaseOffsets))

208 return true;

209 return false;

210}

211

214 for(size_t i = 0; i < Sources.size(); ++i)

216

217}

218

219

220

221

222

223

225 for(size_t i = 0; i < Sources.size(); ++i)

227}

228

230 for(size_t i = 0; i < Sources.size(); ++i)

232}

233

235 for(size_t i = 0; i < Sources.size(); ++i)

237}

238

240 for(size_t i = 0; i < Sources.size(); ++i)

242}

243

246 for(size_t i = 0; i < Sources.size(); ++i)

248}

249

251 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {

252 for(size_t i = 0; i < Sources.size(); ++i)

254}

255

259 Exprs) {

260 for (auto &Source : Sources)

261 Source->ReadMismatchingDeleteExpressions(Exprs);

262}

263

265 for(size_t i = 0; i < Sources.size(); ++i)

267

268 return !R.empty();

269}

270

273 for(size_t i = 0; i < Sources.size(); ++i)

275}

276

279 for(size_t i = 0; i < Sources.size(); ++i)

281}

282

285 for(size_t i = 0; i < Sources.size(); ++i)

287}

288

291 for(size_t i = 0; i < Sources.size(); ++i)

293}

294

297 for(size_t i = 0; i < Sources.size(); ++i)

299}

300

303 for(size_t i = 0; i < Sources.size(); ++i)

305}

306

308 SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {

309 for(size_t i = 0; i < Sources.size(); ++i)

311}

312

314 SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI) {

315 for(size_t i = 0; i < Sources.size(); ++i)

317}

318

321 for(size_t i = 0; i < Sources.size(); ++i)

323}

324

328 for(size_t i = 0; i < Sources.size(); ++i)

330}

331

333 llvm::MapVector<const FunctionDecl *, std::unique_ptr>

334 &LPTMap) {

335 for (size_t i = 0; i < Sources.size(); ++i)

337}

338

344 bool EnteringContext,

346 for (size_t I = 0, E = Sources.size(); I < E; ++I) {

348 MemberContext,

349 EnteringContext, OPT))

350 return C;

351 }

353}

354

357 for (size_t I = 0, E = Sources.size(); I < E; ++I) {

359 return true;

360 }

361 return false;

362}

363

366 for (auto *Source : Sources)

367 Source->AssignedLambdaNumbering(Lambda);

368}

llvm::MachO::Record Record

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

Represents a base class of a C++ class.

Represents a C++ base or member initializer.

Represents a C++ struct/union/class.

Represents a C++ nested-name-specifier or a global scope specifier.

Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...

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.

MemoryBufferSizes getMemoryBufferSizes() const

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

An abstract interface that should be implemented by external AST sources that also provide informatio...

Represents a member of a struct/union/class.

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

Represents a function declaration or definition.

Represents the results of name lookup.

bool empty() const

Return true if no decls were found.

Describes a module or submodule.

void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > &LPTMap) override

Read the set of late parsed template functions for this source.

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

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

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

Load all the external specializations for the Decl.

void updateOutOfDateSelector(Selector Sel) override

Load the contents of the global method pool for a given selector if necessary.

Stmt * GetExternalDeclStmt(uint64_t Offset) override

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

TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, int LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT) override

Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...

bool LookupUnqualified(LookupResult &R, Scope *S) override

Do last resort, unqualified lookup on a LookupResult that Sema cannot find.

void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override

Read the set of delegating constructors known to the external Sema source.

ExtKind hasExternalDefinitions(const Decl *D) override

void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 > > &Exprs) override

void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override

Read the set of unused file-scope declarations known to the external Sema source.

void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls) override

Read the set of decls to be checked for deferred diags.

Selector GetExternalSelector(uint32_t ID) override

Resolve a selector ID into a selector.

CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override

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

void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &Defs) override

Read the set of tentative definitions known to the external Sema source.

void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override

Load the set of used but not defined functions or variables with internal linkage,...

void ReadComments() override

Loads comment ranges.

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

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

void PrintStats() override

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

void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override

Read the set of ext_vector type declarations known to the external Sema source.

void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override

Read the set of potentially unused typedefs known to the source.

void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI) override

Read the set of weak, undeclared identifiers known to the external Sema source.

void AssignedLambdaNumbering(CXXRecordDecl *Lambda) override

Notify the external source that a lambda was assigned a mangling number.

CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override

Resolve a handle to a list of ctor initializers into the list of initializers themselves.

void CompleteType(TagDecl *Tag) override

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

void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override

Read the set of used vtables known to the external Sema source.

MultiplexExternalSemaSource(ExternalSemaSource *S1, ExternalSemaSource *S2)

Constructs a new multiplexing external sema source and appends the given element to it.

void StartedDeserializing() override

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

void FinishedDeserializing() override

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

bool MaybeDiagnoseMissingCompleteType(SourceLocation Loc, QualType T) override

Produces a diagnostic note if one of the attached sources contains a complete definition for T.

void ReadMethodPool(Selector Sel) override

Load the contents of the global method pool for a given selector.

void InitializeSema(Sema &S) override

Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...

void CompleteRedeclChain(const Decl *D) override

Complete the redeclaration chain if it's been extended since the previous generation of the AST sourc...

Decl * GetExternalDecl(GlobalDeclID ID) override

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

void completeVisibleDeclsMap(const DeclContext *DC) override

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

uint32_t GetNumExternalSelectors() override

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

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

Find all declarations with the given name in the given context.

void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override

Read the set of referenced selectors known to the external Sema source.

void StartTranslationUnit(ASTConsumer *Consumer) override

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

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) override

Perform layout on the given record.

void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override

Load the set of namespaces that are known to the external source, which will be used during typo corr...

Module * getModule(unsigned ID) override

Retrieve the module that corresponds to the given module ID.

~MultiplexExternalSemaSource() override

void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override

Read the set of pending instantiations known to the external Sema source.

void AddSource(ExternalSemaSource *Source)

Appends new source to the source list.

void ForgetSema() override

Inform the semantic consumer that Sema is no longer available.

Represents an ObjC class declaration.

Represents a pointer to an Objective C object.

A (possibly-)qualified type.

Represents a struct/union/class.

Scope - A scope is a transient data structure that is used while parsing the program.

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

bool isNull() const

Determine whether this is the empty selector.

Sema - This implements semantic analysis and AST building for C.

Encodes a location in the source.

Stmt - This represents one statement.

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

Simple class containing the result of Sema::CorrectTypo.

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

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

@ Result

The result type of a method or function.

const FunctionProtoType * T

@ Class

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

DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...