Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 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" |
Richard Smith | 053f6c6 | 2014-05-16 23:01:30 +0000 | [diff] [blame] | 17 | #include "clang/AST/ASTContext.h" |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 18 | #include "clang/AST/DeclarationName.h" |
Richard Smith | 053f6c6 | 2014-05-16 23:01:30 +0000 | [diff] [blame] | 19 | #include "llvm/Support/ErrorHandling.h" |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace clang; |
| 22 | |
| 23 | ExternalASTSource::~ExternalASTSource() { } |
| 24 | |
| 25 | void ExternalASTSource::PrintStats() { } |
| 26 | |
| 27 | Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) { |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 28 | return nullptr; |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | Selector ExternalASTSource::GetExternalSelector(uint32_t ID) { |
| 32 | return Selector(); |
| 33 | } |
| 34 | |
| 35 | uint32_t ExternalASTSource::GetNumExternalSelectors() { |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) { |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 40 | return nullptr; |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | CXXBaseSpecifier * |
| 44 | ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 45 | return nullptr; |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 46 | } |
| 47 | |
Richard Smith | 9ce12e3 | 2013-02-07 03:30:24 +0000 | [diff] [blame] | 48 | bool |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 49 | ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, |
| 50 | DeclarationName Name) { |
Richard Smith | 9ce12e3 | 2013-02-07 03:30:24 +0000 | [diff] [blame] | 51 | return false; |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Nick Lewycky | 2bd0ab2 | 2012-04-16 02:51:46 +0000 | [diff] [blame] | 54 | void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) { |
| 55 | } |
| 56 | |
| 57 | ExternalLoadResult |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 58 | ExternalASTSource::FindExternalLexicalDecls(const DeclContext *DC, |
| 59 | bool (*isKindWeWant)(Decl::Kind), |
Chris Lattner | 0e62c1c | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 60 | SmallVectorImpl<Decl*> &Result) { |
Douglas Gregor | 3d0adb3 | 2011-07-15 21:46:17 +0000 | [diff] [blame] | 61 | return ELR_AlreadyLoaded; |
Axel Naumann | aa627ba | 2011-02-28 11:22:50 +0000 | [diff] [blame] | 62 | } |
Axel Naumann | ed35df1 | 2011-05-04 12:59:24 +0000 | [diff] [blame] | 63 | |
| 64 | void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const { } |
Richard Smith | 053f6c6 | 2014-05-16 23:01:30 +0000 | [diff] [blame] | 65 | |
| 66 | uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) { |
| 67 | uint32_t OldGeneration = CurrentGeneration; |
| 68 | |
| 69 | // Make sure the generation of the topmost external source for the context is |
| 70 | // incremented. That might not be us. |
| 71 | auto *P = C.getExternalSource(); |
| 72 | if (P && P != this) |
| 73 | CurrentGeneration = P->incrementGeneration(C); |
| 74 | else { |
| 75 | // FIXME: Only bump the generation counter if the current generation number |
| 76 | // has been observed? |
| 77 | if (!++CurrentGeneration) |
| 78 | llvm::report_fatal_error("generation counter overflowed", false); |
| 79 | } |
| 80 | |
| 81 | return OldGeneration; |
| 82 | } |