blob: 57b9ce3115e908b65866d6b1e2b639d7857bcf52 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001//===--- 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
21namespace clang {
22
23namespace idx {
24 class EntityListener;
25
26class ProgramImpl {
27public:
28 typedef llvm::FoldingSet<EntityImpl> EntitySetTy;
29
30private:
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
40public:
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