]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/AST/ExternalASTSource.cpp
Merge OpenBSM 1.2 alpha 4.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / AST / ExternalASTSource.cpp
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
16 #include "clang/AST/ExternalASTSource.h"
17 #include "clang/AST/ASTContext.h"
18 #include "clang/AST/DeclarationName.h"
19 #include "llvm/Support/ErrorHandling.h"
20
21 using namespace clang;
22
23 ExternalASTSource::~ExternalASTSource() { }
24
25 llvm::Optional<ExternalASTSource::ASTSourceDescriptor>
26 ExternalASTSource::getSourceDescriptor(unsigned ID) {
27   return None;
28 }
29
30 ExternalASTSource::ASTSourceDescriptor
31 ExternalASTSource::getSourceDescriptor(const Module &M) {
32   return ASTSourceDescriptor();
33 }
34
35 void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset,
36                                             unsigned Length,
37                                             SmallVectorImpl<Decl *> &Decls) {}
38
39 void ExternalASTSource::CompleteRedeclChain(const Decl *D) {}
40
41 void ExternalASTSource::CompleteType(TagDecl *Tag) {}
42
43 void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {}
44
45 void ExternalASTSource::ReadComments() {}
46
47 void ExternalASTSource::StartedDeserializing() {}
48
49 void ExternalASTSource::FinishedDeserializing() {}
50
51 void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {}
52
53 void ExternalASTSource::PrintStats() { }
54
55 bool ExternalASTSource::layoutRecordType(
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
63 Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) {
64   return nullptr;
65 }
66
67 Selector ExternalASTSource::GetExternalSelector(uint32_t ID) {
68   return Selector();
69 }
70
71 uint32_t ExternalASTSource::GetNumExternalSelectors() {
72    return 0;
73 }
74
75 Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) {
76   return nullptr;
77 }
78
79 CXXCtorInitializer **
80 ExternalASTSource::GetExternalCXXCtorInitializers(uint64_t Offset) {
81   return nullptr;
82 }
83
84 CXXBaseSpecifier *
85 ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
86   return nullptr;
87 }
88
89 bool
90 ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC,
91                                                   DeclarationName Name) {
92   return false;
93 }
94
95 void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) {
96 }
97
98 ExternalLoadResult
99 ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC,
100                                             bool (*isKindWeWant)(Decl::Kind),
101                                          SmallVectorImpl<Decl*> &Result) {
102   return ELR_AlreadyLoaded;
103 }
104
105 void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const { }
106
107 uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) {
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 }