1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | #include "clang/AST/ExternalASTSource.h" |
16 | #include "clang/AST/ASTContext.h" |
17 | #include "clang/AST/DeclarationName.h" |
18 | #include "clang/Basic/IdentifierTable.h" |
19 | #include "clang/Basic/LLVM.h" |
20 | #include "clang/Basic/Module.h" |
21 | #include "llvm/ADT/None.h" |
22 | #include "llvm/Support/ErrorHandling.h" |
23 | #include <cstdint> |
24 | |
25 | using namespace clang; |
26 | |
27 | ExternalASTSource::~ExternalASTSource() = default; |
28 | |
29 | llvm::Optional<ExternalASTSource::ASTSourceDescriptor> |
30 | ExternalASTSource::getSourceDescriptor(unsigned ID) { |
31 | return None; |
32 | } |
33 | |
34 | ExternalASTSource::ExtKind |
35 | ExternalASTSource::hasExternalDefinitions(const Decl *D) { |
36 | return EK_ReplyHazy; |
37 | } |
38 | |
39 | ExternalASTSource::ASTSourceDescriptor::ASTSourceDescriptor(const Module &M) |
40 | : Signature(M.Signature), ClangModule(&M) { |
41 | if (M.Directory) |
42 | Path = M.Directory->getName(); |
43 | if (auto *File = M.getASTFile()) |
44 | ASTFile = File->getName(); |
45 | } |
46 | |
47 | std::string ExternalASTSource::ASTSourceDescriptor::getModuleName() const { |
48 | if (ClangModule) |
49 | return ClangModule->Name; |
50 | else |
51 | return PCHModuleName; |
52 | } |
53 | |
54 | void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset, |
55 | unsigned Length, |
56 | SmallVectorImpl<Decl *> &Decls) {} |
57 | |
58 | void ExternalASTSource::CompleteRedeclChain(const Decl *D) {} |
59 | |
60 | void ExternalASTSource::CompleteType(TagDecl *Tag) {} |
61 | |
62 | void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {} |
63 | |
64 | void ExternalASTSource::() {} |
65 | |
66 | void ExternalASTSource::StartedDeserializing() {} |
67 | |
68 | void ExternalASTSource::FinishedDeserializing() {} |
69 | |
70 | void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {} |
71 | |
72 | void ExternalASTSource::PrintStats() {} |
73 | |
74 | bool ExternalASTSource::layoutRecordType( |
75 | const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, |
76 | llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets, |
77 | llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets, |
78 | llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) { |
79 | return false; |
80 | } |
81 | |
82 | Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) { |
83 | return nullptr; |
84 | } |
85 | |
86 | Selector ExternalASTSource::GetExternalSelector(uint32_t ID) { |
87 | return Selector(); |
88 | } |
89 | |
90 | uint32_t ExternalASTSource::GetNumExternalSelectors() { |
91 | return 0; |
92 | } |
93 | |
94 | Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) { |
95 | return nullptr; |
96 | } |
97 | |
98 | CXXCtorInitializer ** |
99 | ExternalASTSource::GetExternalCXXCtorInitializers(uint64_t Offset) { |
100 | return nullptr; |
101 | } |
102 | |
103 | CXXBaseSpecifier * |
104 | ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { |
105 | return nullptr; |
106 | } |
107 | |
108 | bool |
109 | ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, |
110 | DeclarationName Name) { |
111 | return false; |
112 | } |
113 | |
114 | void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) {} |
115 | |
116 | void ExternalASTSource::FindExternalLexicalDecls( |
117 | const DeclContext *DC, llvm::function_ref<bool(Decl::Kind)> IsKindWeWant, |
118 | SmallVectorImpl<Decl *> &Result) {} |
119 | |
120 | void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const {} |
121 | |
122 | uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) { |
123 | uint32_t OldGeneration = CurrentGeneration; |
124 | |
125 | |
126 | |
127 | auto *P = C.getExternalSource(); |
128 | if (P && P != this) |
129 | CurrentGeneration = P->incrementGeneration(C); |
130 | else { |
131 | |
132 | |
133 | if (!++CurrentGeneration) |
134 | llvm::report_fatal_error("generation counter overflowed", false); |
135 | } |
136 | |
137 | return OldGeneration; |
138 | } |
139 | |