aboutsummaryrefslogtreecommitdiff
path: root/lib/Index/ProgramImpl.h
blob: 52f153f1dcd7863b8fae8e265d7f433db358163f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===--- ProgramImpl.h - Internal Program implementation---------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  Internal implementation for the Program class
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_INDEX_PROGRAMIMPL_H
#define LLVM_CLANG_INDEX_PROGRAMIMPL_H

#include "clang/Index/Entity.h"
#include "llvm/ADT/StringSet.h"

namespace clang {

namespace idx {
  class EntityListener;

class ProgramImpl {
public:
  typedef llvm::FoldingSet<Entity> EntitySetTy;
  typedef llvm::StringMapEntry<char> IdEntryTy;
  
private:
  llvm::FoldingSet<Entity> Entities;
  llvm::StringSet<> Idents;
  llvm::BumpPtrAllocator BumpAlloc;

  ProgramImpl(const ProgramImpl&); // do not implement
  ProgramImpl &operator=(const ProgramImpl &); // do not implement
  
public:
  ProgramImpl() { }
  
  llvm::FoldingSet<Entity> &getEntities() { return Entities; }
  llvm::StringSet<> &getIdents() { return Idents; }

  void *Allocate(unsigned Size, unsigned Align = 8) {
    return BumpAlloc.Allocate(Size, Align);
  }
};

} // namespace idx

} // namespace clang

#endif