diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-05 22:22:19 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-05 22:22:19 +0000 |
commit | 9eec4ed6ca0dcf098580da9146b97e0841556d12 (patch) | |
tree | 990b7278fb0983249a24c985f00fc4ff361a7d42 /lib/Index/ProgramImpl.h | |
parent | 2c2ba3e258961dd98cacffe3a2167bb6d958fd53 (diff) |
Introduce the 'Index' library.
Its purpose is to provide the basic infrastructure for cross-translation-unit analysis like indexing, refactoring, etc.
Currently it is very "primitive" and with no type-names support. It can provide functionality like
"show me all references of this function from these translation units".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index/ProgramImpl.h')
-rw-r--r-- | lib/Index/ProgramImpl.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/Index/ProgramImpl.h b/lib/Index/ProgramImpl.h new file mode 100644 index 0000000000..52f153f1dc --- /dev/null +++ b/lib/Index/ProgramImpl.h @@ -0,0 +1,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 |