ExternalASTSource.cpp revision 6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89
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 21using namespace clang; 22 23ExternalASTSource::~ExternalASTSource() { } 24 25void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset, 26 unsigned Length, 27 SmallVectorImpl<Decl *> &Decls) {} 28 29void ExternalASTSource::CompleteRedeclChain(const Decl *D) {} 30 31void ExternalASTSource::CompleteType(TagDecl *Tag) {} 32 33void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {} 34 35void ExternalASTSource::ReadComments() {} 36 37void ExternalASTSource::StartedDeserializing() {} 38 39void ExternalASTSource::FinishedDeserializing() {} 40 41void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {} 42 43void ExternalASTSource::PrintStats() { } 44 45bool 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) { 50 return false; 51} 52 53Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) { 54 return nullptr; 55} 56 57Selector ExternalASTSource::GetExternalSelector(uint32_t ID) { 58 return Selector(); 59} 60 61uint32_t ExternalASTSource::GetNumExternalSelectors() { 62 return 0; 63} 64 65Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) { 66 return nullptr; 67} 68 69CXXBaseSpecifier * 70ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { 71 return nullptr; 72} 73 74bool 75ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, 76 DeclarationName Name) { 77 return false; 78} 79 80void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) { 81} 82 83ExternalLoadResult 84ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC, 85 bool (*isKindWeWant)(Decl::Kind), 86 SmallVectorImpl<Decl*> &Result) { 87 return ELR_AlreadyLoaded; 88} 89 90void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const { } 91 92uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) { 93 uint32_t OldGeneration = CurrentGeneration; 94 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(); 98 if (P && P != this) 99 CurrentGeneration = P->incrementGeneration(C); 100 else { 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); 105 } 106 107 return OldGeneration; 108} 109