Argyrios Kyrtzidis | 9eec4ed | 2009-07-05 22:22:19 +0000 | [diff] [blame^] | 1 | //===--- ProgramImpl.h - Internal Program implementation---------*- 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 | // Internal implementation for the Program class |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CLANG_INDEX_PROGRAMIMPL_H |
| 15 | #define LLVM_CLANG_INDEX_PROGRAMIMPL_H |
| 16 | |
| 17 | #include "clang/Index/Entity.h" |
| 18 | #include "llvm/ADT/StringSet.h" |
| 19 | |
| 20 | namespace clang { |
| 21 | |
| 22 | namespace idx { |
| 23 | class EntityListener; |
| 24 | |
| 25 | class ProgramImpl { |
| 26 | public: |
| 27 | typedef llvm::FoldingSet<Entity> EntitySetTy; |
| 28 | typedef llvm::StringMapEntry<char> IdEntryTy; |
| 29 | |
| 30 | private: |
| 31 | llvm::FoldingSet<Entity> Entities; |
| 32 | llvm::StringSet<> Idents; |
| 33 | llvm::BumpPtrAllocator BumpAlloc; |
| 34 | |
| 35 | ProgramImpl(const ProgramImpl&); // do not implement |
| 36 | ProgramImpl &operator=(const ProgramImpl &); // do not implement |
| 37 | |
| 38 | public: |
| 39 | ProgramImpl() { } |
| 40 | |
| 41 | llvm::FoldingSet<Entity> &getEntities() { return Entities; } |
| 42 | llvm::StringSet<> &getIdents() { return Idents; } |
| 43 | |
| 44 | void *Allocate(unsigned Size, unsigned Align = 8) { |
| 45 | return BumpAlloc.Allocate(Size, Align); |
| 46 | } |
| 47 | }; |
| 48 | |
| 49 | } // namespace idx |
| 50 | |
| 51 | } // namespace clang |
| 52 | |
| 53 | #endif |