clang API Documentation

ProgramImpl.h
Go to the documentation of this file.
00001 //===--- ProgramImpl.h - Internal Program implementation---------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  Internal implementation for the Program class
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_CLANG_INDEX_PROGRAMIMPL_H
00015 #define LLVM_CLANG_INDEX_PROGRAMIMPL_H
00016 
00017 #include "EntityImpl.h"
00018 #include "clang/Basic/IdentifierTable.h"
00019 #include "clang/Basic/LangOptions.h"
00020 
00021 namespace clang {
00022 
00023 namespace idx {
00024   class EntityListener;
00025 
00026 class ProgramImpl {
00027 public:
00028   typedef llvm::FoldingSet<EntityImpl> EntitySetTy;
00029 
00030 private:
00031   EntitySetTy Entities;
00032   llvm::BumpPtrAllocator BumpAlloc;
00033 
00034   IdentifierTable Identifiers;
00035   SelectorTable Selectors;
00036 
00037   ProgramImpl(const ProgramImpl&); // do not implement
00038   ProgramImpl &operator=(const ProgramImpl &); // do not implement
00039 
00040 public:
00041   ProgramImpl() : Identifiers(LangOptions()) { }
00042 
00043   EntitySetTy &getEntities() { return Entities; }
00044   IdentifierTable &getIdents() { return Identifiers; }
00045   SelectorTable &getSelectors() { return Selectors; }
00046 
00047   void *Allocate(unsigned Size, unsigned Align = 8) {
00048     return BumpAlloc.Allocate(Size, Align);
00049   }
00050 };
00051 
00052 } // namespace idx
00053 
00054 } // namespace clang
00055 
00056 #endif