1 //===- ExternalASTSource.cpp - Abstract External AST Interface --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides the default implementation of the ExternalASTSource
11 // interface, which enables construction of AST nodes from some external
14 //===----------------------------------------------------------------------===//
16 #include "clang/AST/ExternalASTSource.h"
17 #include "clang/AST/ASTContext.h"
18 #include "clang/AST/DeclarationName.h"
19 #include "llvm/Support/ErrorHandling.h"
21 using namespace clang;
23 ExternalASTSource::~ExternalASTSource() { }
25 void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset,
27 SmallVectorImpl<Decl *> &Decls) {}
29 void ExternalASTSource::CompleteRedeclChain(const Decl *D) {}
31 void ExternalASTSource::CompleteType(TagDecl *Tag) {}
33 void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {}
35 void ExternalASTSource::ReadComments() {}
37 void ExternalASTSource::StartedDeserializing() {}
39 void ExternalASTSource::FinishedDeserializing() {}
41 void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {}
43 void ExternalASTSource::PrintStats() { }
45 bool ExternalASTSource::layoutRecordType(
46 const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
47 llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
48 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
49 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) {
53 Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) {
57 Selector ExternalASTSource::GetExternalSelector(uint32_t ID) {
61 uint32_t ExternalASTSource::GetNumExternalSelectors() {
65 Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) {
70 ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
75 ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC,
76 DeclarationName Name) {
80 void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) {
84 ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC,
85 bool (*isKindWeWant)(Decl::Kind),
86 SmallVectorImpl<Decl*> &Result) {
87 return ELR_AlreadyLoaded;
90 void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const { }
92 uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) {
93 uint32_t OldGeneration = CurrentGeneration;
95 // Make sure the generation of the topmost external source for the context is
96 // incremented. That might not be us.
97 auto *P = C.getExternalSource();
99 CurrentGeneration = P->incrementGeneration(C);
101 // FIXME: Only bump the generation counter if the current generation number
102 // has been observed?
103 if (!++CurrentGeneration)
104 llvm::report_fatal_error("generation counter overflowed", false);
107 return OldGeneration;