summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Index/Entity.cpp10
-rw-r--r--clang/lib/Index/EntityImpl.h13
-rw-r--r--clang/lib/Index/ProgramImpl.h9
3 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/Index/Entity.cpp b/clang/lib/Index/Entity.cpp
index d33110074f2..8c7c8d0ef57 100644
--- a/clang/lib/Index/Entity.cpp
+++ b/clang/lib/Index/Entity.cpp
@@ -70,9 +70,8 @@ Entity EntityGetter::VisitNamedDecl(NamedDecl *D) {
if (!II)
return Entity();
- EntityImpl::IdEntryTy *Id =
- &Prog.getIdents().GetOrCreateValue(II->getName(),
- II->getName() + II->getLength());
+ IdentifierInfo *Id = &Prog.getIdents().get(II->getName(),
+ II->getName() + II->getLength());
unsigned IdNS = D->getIdentifierNamespace();
llvm::FoldingSetNodeID ID;
@@ -117,7 +116,8 @@ Decl *EntityImpl::getDecl(ASTContext &AST) {
if (!DC)
return 0; // Couldn't get the parent context.
- IdentifierInfo &II = AST.Idents.get(Id->getKeyData());
+ IdentifierInfo &II = AST.Idents.get(Id->getName(),
+ Id->getName() + Id->getLength());
DeclContext::lookup_result Res = DC->lookup(DeclarationName(&II));
for (DeclContext::lookup_iterator I = Res.first, E = Res.second; I!=E; ++I) {
@@ -136,7 +136,7 @@ Entity EntityImpl::get(Decl *D, ProgramImpl &Prog) {
}
std::string EntityImpl::getPrintableName() {
- return std::string(Id->getKeyData(), Id->getKeyData() + Id->getKeyLength());
+ return Id->getName();
}
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/Index/EntityImpl.h b/clang/lib/Index/EntityImpl.h
index 3f09f80fc1f..d28936ee2cb 100644
--- a/clang/lib/Index/EntityImpl.h
+++ b/clang/lib/Index/EntityImpl.h
@@ -19,23 +19,20 @@
#include "llvm/ADT/StringSet.h"
namespace clang {
+ class IdentifierInfo;
namespace idx {
class ProgramImpl;
class EntityImpl : public llvm::FoldingSetNode {
-public:
- typedef llvm::StringMapEntry<char> IdEntryTy;
-
-private:
Entity Parent;
- IdEntryTy *Id;
+ IdentifierInfo *Id;
/// \brief Identifier namespace.
unsigned IdNS;
public:
- EntityImpl(Entity parent, IdEntryTy *id, unsigned idNS)
+ EntityImpl(Entity parent, IdentifierInfo *id, unsigned idNS)
: Parent(parent), Id(id), IdNS(idNS) { }
/// \brief Find the Decl that can be referred to by this entity.
@@ -50,8 +47,8 @@ public:
void Profile(llvm::FoldingSetNodeID &ID) const {
Profile(ID, Parent, Id, IdNS);
}
- static void Profile(llvm::FoldingSetNodeID &ID, Entity Parent, IdEntryTy *Id,
- unsigned IdNS) {
+ static void Profile(llvm::FoldingSetNodeID &ID, Entity Parent,
+ IdentifierInfo *Id, unsigned IdNS) {
ID.AddPointer(Parent.getAsOpaquePtr());
ID.AddPointer(Id);
ID.AddInteger(IdNS);
diff --git a/clang/lib/Index/ProgramImpl.h b/clang/lib/Index/ProgramImpl.h
index 39fc184677d..b962a2d3275 100644
--- a/clang/lib/Index/ProgramImpl.h
+++ b/clang/lib/Index/ProgramImpl.h
@@ -15,6 +15,8 @@
#define LLVM_CLANG_INDEX_PROGRAMIMPL_H
#include "EntityImpl.h"
+#include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/LangOptions.h"
namespace clang {
@@ -27,17 +29,18 @@ public:
private:
EntitySetTy Entities;
- llvm::StringSet<> Idents;
llvm::BumpPtrAllocator BumpAlloc;
+
+ IdentifierTable Identifiers;
ProgramImpl(const ProgramImpl&); // do not implement
ProgramImpl &operator=(const ProgramImpl &); // do not implement
public:
- ProgramImpl() { }
+ ProgramImpl() : Identifiers(LangOptions()) { }
EntitySetTy &getEntities() { return Entities; }
- llvm::StringSet<> &getIdents() { return Idents; }
+ IdentifierTable &getIdents() { return Identifiers; }
void *Allocate(unsigned Size, unsigned Align = 8) {
return BumpAlloc.Allocate(Size, Align);
OpenPOWER on IntegriCloud