blob: 57b9ce3115e908b65866d6b1e2b639d7857bcf52 [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;
Mike Stump1eb44332009-09-09 15:08:12 +000033
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000034 IdentifierTable Identifiers;
Argyrios Kyrtzidis27bd0dc2009-07-29 23:40:32 +000035 SelectorTable Selectors;
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000036
37 ProgramImpl(const ProgramImpl&); // do not implement
38 ProgramImpl &operator=(const ProgramImpl &); // do not implement
Mike Stump1eb44332009-09-09 15:08:12 +000039
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000040public:
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000041 ProgramImpl() : Identifiers(LangOptions()) { }
Mike Stump1eb44332009-09-09 15:08:12 +000042
Argyrios Kyrtzidisf7cf15c2009-07-21 00:07:06 +000043 EntitySetTy &getEntities() { return Entities; }
Argyrios Kyrtzidisdc1792c2009-07-29 23:40:21 +000044 IdentifierTable &getIdents() { return Identifiers; }
Argyrios Kyrtzidis27bd0dc2009-07-29 23:40:32 +000045 SelectorTable &getSelectors() { return Selectors; }
Argyrios Kyrtzidis9eec4ed2009-07-05 22:22:19 +000046
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