clang API Documentation
00001 //===- ExternalASTSource.cpp - Abstract External AST Interface --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file provides the default implementation of the ExternalASTSource 00011 // interface, which enables construction of AST nodes from some external 00012 // source. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #include "clang/AST/ExternalASTSource.h" 00017 #include "clang/AST/ASTContext.h" 00018 #include "clang/AST/DeclarationName.h" 00019 #include "llvm/Support/ErrorHandling.h" 00020 00021 using namespace clang; 00022 00023 ExternalASTSource::~ExternalASTSource() { } 00024 00025 void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset, 00026 unsigned Length, 00027 SmallVectorImpl<Decl *> &Decls) {} 00028 00029 void ExternalASTSource::CompleteRedeclChain(const Decl *D) {} 00030 00031 void ExternalASTSource::CompleteType(TagDecl *Tag) {} 00032 00033 void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {} 00034 00035 void ExternalASTSource::ReadComments() {} 00036 00037 void ExternalASTSource::StartedDeserializing() {} 00038 00039 void ExternalASTSource::FinishedDeserializing() {} 00040 00041 void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {} 00042 00043 void ExternalASTSource::PrintStats() { } 00044 00045 bool ExternalASTSource::layoutRecordType( 00046 const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, 00047 llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets, 00048 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets, 00049 llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) { 00050 return false; 00051 } 00052 00053 Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) { 00054 return nullptr; 00055 } 00056 00057 Selector ExternalASTSource::GetExternalSelector(uint32_t ID) { 00058 return Selector(); 00059 } 00060 00061 uint32_t ExternalASTSource::GetNumExternalSelectors() { 00062 return 0; 00063 } 00064 00065 Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) { 00066 return nullptr; 00067 } 00068 00069 CXXBaseSpecifier * 00070 ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { 00071 return nullptr; 00072 } 00073 00074 bool 00075 ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, 00076 DeclarationName Name) { 00077 return false; 00078 } 00079 00080 void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) { 00081 } 00082 00083 ExternalLoadResult 00084 ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC, 00085 bool (*isKindWeWant)(Decl::Kind), 00086 SmallVectorImpl<Decl*> &Result) { 00087 return ELR_AlreadyLoaded; 00088 } 00089 00090 void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const { } 00091 00092 uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) { 00093 uint32_t OldGeneration = CurrentGeneration; 00094 00095 // Make sure the generation of the topmost external source for the context is 00096 // incremented. That might not be us. 00097 auto *P = C.getExternalSource(); 00098 if (P && P != this) 00099 CurrentGeneration = P->incrementGeneration(C); 00100 else { 00101 // FIXME: Only bump the generation counter if the current generation number 00102 // has been observed? 00103 if (!++CurrentGeneration) 00104 llvm::report_fatal_error("generation counter overflowed", false); 00105 } 00106 00107 return OldGeneration; 00108 }