]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/lib/Index/ProgramImpl.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / tools / clang / lib / Index / ProgramImpl.h
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 "EntityImpl.h"
18 #include "clang/Basic/IdentifierTable.h"
19 #include "clang/Basic/LangOptions.h"
20
21 namespace clang {
22
23 namespace idx {
24   class EntityListener;
25
26 class ProgramImpl {
27 public:
28   typedef llvm::FoldingSet<EntityImpl> EntitySetTy;
29
30 private:
31   EntitySetTy Entities;
32   llvm::BumpPtrAllocator BumpAlloc;
33
34   IdentifierTable Identifiers;
35   SelectorTable Selectors;
36
37   ProgramImpl(const ProgramImpl&); // do not implement
38   ProgramImpl &operator=(const ProgramImpl &); // do not implement
39
40 public:
41   ProgramImpl() : Identifiers(LangOptions()) { }
42
43   EntitySetTy &getEntities() { return Entities; }
44   IdentifierTable &getIdents() { return Identifiers; }
45   SelectorTable &getSelectors() { return Selectors; }
46
47   void *Allocate(unsigned Size, unsigned Align = 8) {
48     return BumpAlloc.Allocate(Size, Align);
49   }
50 };
51
52 } // namespace idx
53
54 } // namespace clang
55
56 #endif