[cfe-commits] r77537 - in /cfe/trunk/lib/Index: Entity.cpp EntityImpl.h ProgramImpl.h
Argiris Kirtzidis
akyrtzi at gmail.com
Wed Jul 29 16:40:21 PDT 2009
Author: akirtzidis
Date: Wed Jul 29 18:40:21 2009
New Revision: 77537
URL: http://llvm.org/viewvc/llvm-project?rev=77537&view=rev
Log:
Use an IdentifierTable for names used for Entities.
Modified:
cfe/trunk/lib/Index/Entity.cpp
cfe/trunk/lib/Index/EntityImpl.h
cfe/trunk/lib/Index/ProgramImpl.h
Modified: cfe/trunk/lib/Index/Entity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/Entity.cpp?rev=77537&r1=77536&r2=77537&view=diff
==============================================================================
--- cfe/trunk/lib/Index/Entity.cpp (original)
+++ cfe/trunk/lib/Index/Entity.cpp Wed Jul 29 18:40:21 2009
@@ -70,9 +70,8 @@
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 @@
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 @@
}
std::string EntityImpl::getPrintableName() {
- return std::string(Id->getKeyData(), Id->getKeyData() + Id->getKeyLength());
+ return Id->getName();
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Index/EntityImpl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/EntityImpl.h?rev=77537&r1=77536&r2=77537&view=diff
==============================================================================
--- cfe/trunk/lib/Index/EntityImpl.h (original)
+++ cfe/trunk/lib/Index/EntityImpl.h Wed Jul 29 18:40:21 2009
@@ -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 @@
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);
Modified: cfe/trunk/lib/Index/ProgramImpl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ProgramImpl.h?rev=77537&r1=77536&r2=77537&view=diff
==============================================================================
--- cfe/trunk/lib/Index/ProgramImpl.h (original)
+++ cfe/trunk/lib/Index/ProgramImpl.h Wed Jul 29 18:40:21 2009
@@ -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 @@
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);
More information about the cfe-commits
mailing list