blob: b962a2d3275434628da20f18871846eb5e1b2da6 [file] [log] [blame]
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +00001//===--- 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
Argyrios Kyrtzidisf7cf15c2009-07-21 00:07:06 +000017#include "EntityImpl.h"
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000018#include "clang/Basic/IdentifierTable.h"
19#include "clang/Basic/LangOptions.h"
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000020
21namespace clang {
22
23namespace idx {
24 class EntityListener;
25
26class ProgramImpl {
27public:
Argyrios Kyrtzidisf7cf15c2009-07-21 00:07:06 +000028 typedef llvm::FoldingSet<EntityImpl> EntitySetTy;
29
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000030private:
Argyrios Kyrtzidisf7cf15c2009-07-21 00:07:06 +000031 EntitySetTy Entities;
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000032 llvm::BumpPtrAllocator BumpAlloc;
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000033
34 IdentifierTable Identifiers;
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000035
36 ProgramImpl(const ProgramImpl&); // do not implement
37 ProgramImpl &operator=(const ProgramImpl &); // do not implement
38
39public:
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000040 ProgramImpl() : Identifiers(LangOptions()) { }
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000041
Argyrios Kyrtzidisf7cf15c2009-07-21 00:07:06 +000042 EntitySetTy &getEntities() { return Entities; }
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000043 IdentifierTable &getIdents() { return Identifiers; }
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000044
45 void *Allocate(unsigned Size, unsigned Align = 8) {
46 return BumpAlloc.Allocate(Size, Align);
47 }
48};
49
50} // namespace idx
51
52} // namespace clang
53
54#endif