clang  3.7.0
ExternalASTSource.cpp
Go to the documentation of this file.
1 //===- ExternalASTSource.cpp - Abstract External AST Interface --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides the default implementation of the ExternalASTSource
11 // interface, which enables construction of AST nodes from some external
12 // source.
13 //
14 //===----------------------------------------------------------------------===//
15 
17 #include "clang/AST/ASTContext.h"
19 #include "llvm/Support/ErrorHandling.h"
20 
21 using namespace clang;
22 
24 
27  return None;
28 }
29 
32  return ASTSourceDescriptor();
33 }
34 
36  unsigned Length,
37  SmallVectorImpl<Decl *> &Decls) {}
38 
40 
42 
44 
46 
48 
50 
52 
54 
56  const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
57  llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
58  llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
59  llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) {
60  return false;
61 }
62 
64  return nullptr;
65 }
66 
68  return Selector();
69 }
70 
72  return 0;
73 }
74 
76  return nullptr;
77 }
78 
81  return nullptr;
82 }
83 
86  return nullptr;
87 }
88 
89 bool
91  DeclarationName Name) {
92  return false;
93 }
94 
96 }
97 
100  bool (*isKindWeWant)(Decl::Kind),
101  SmallVectorImpl<Decl*> &Result) {
102  return ELR_AlreadyLoaded;
103 }
104 
106 
108  uint32_t OldGeneration = CurrentGeneration;
109 
110  // Make sure the generation of the topmost external source for the context is
111  // incremented. That might not be us.
112  auto *P = C.getExternalSource();
113  if (P && P != this)
114  CurrentGeneration = P->incrementGeneration(C);
115  else {
116  // FIXME: Only bump the generation counter if the current generation number
117  // has been observed?
118  if (!++CurrentGeneration)
119  llvm::report_fatal_error("generation counter overflowed", false);
120  }
121 
122  return OldGeneration;
123 }
Defines the clang::ASTContext interface.
Smart pointer class that efficiently represents Objective-C method names.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
virtual uint32_t GetNumExternalSelectors()
Returns the number of selectors known to the external AST source.
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 void PrintStats()
Print any statistics that have been gathered regarding the external AST source.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
virtual Selector GetExternalSelector(uint32_t ID)
Resolve a selector ID into a selector.
virtual void StartedDeserializing()
Notify ExternalASTSource that we started deserialization of a decl or type so until FinishedDeseriali...
MemoryBufferSizes getMemoryBufferSizes() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
uint32_t incrementGeneration(ASTContext &C)
Increment the current generation.
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...
Describes a module or submodule.
Definition: Basic/Module.h:49
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. Length can be 0 to indicate a ...
virtual bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name)
Find all declarations with the given name in the given context, and add them to the context by callin...
uint32_t Offset
Definition: CacheTokens.cpp:43
virtual void FinishedDeserializing()
Notify ExternalASTSource that we finished the deserialization of a decl or type. Must be paired with ...
virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, bool(*isKindWeWant)(Decl::Kind), SmallVectorImpl< Decl * > &Result)
Finds all declarations lexically contained within the given DeclContext, after applying an optional f...
Represents an ObjC class declaration.
Definition: DeclObjC.h:851
AnnotatingParser & P
virtual void completeVisibleDeclsMap(const DeclContext *DC)
Ensures that the table of all visible declarations inside this context is up to date.
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
ExternalLoadResult
Enumeration describing the result of loading information from an external source. ...
The external information has already been loaded, and therefore no additional processing is required...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
Definition: ASTContext.h:864
virtual Stmt * GetExternalDeclStmt(uint64_t Offset)
Resolve the offset of a statement in the decl stream into a statement.
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2694
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
virtual void StartTranslationUnit(ASTConsumer *Consumer)
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
virtual void ReadComments()
Loads comment ranges.
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...
Represents a C++ base or member initializer.
Definition: DeclCXX.h:1901
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
Represents a base class of a C++ class.
Definition: DeclCXX.h:157
virtual llvm::Optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID)
Return a descriptor for the corresponding module, if one exists.
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:76
Holds everything needed to generate debug info for an imported module or precompiled header file...