Kill CXEntity and CXDecl. The first has never been used, while the

second has been wholly replaced by cursors.

llvm-svn: 94039
This commit is contained in:
Douglas Gregor 2010-01-20 22:14:22 +00:00
parent 401982f56c
commit 721e82edbc
3 changed files with 0 additions and 77 deletions

View File

@ -54,7 +54,6 @@ typedef void *CXIndex; /* An indexing instance. */
typedef void *CXTranslationUnit; /* A translation unit instance. */
typedef void *CXFile; /* A source file */
typedef void *CXDecl; /* A specific declaration within a translation unit. */
/* Cursors represent declarations, definitions, and references. */
enum CXCursorKind {
@ -219,12 +218,6 @@ typedef struct {
void *data[3];
} CXCursor;
/* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */
typedef struct {
CXIndex index;
void *data;
} CXEntity;
/**
* For functions returning a string that might or might not need
* to be internally allocated and freed.
@ -427,19 +420,6 @@ CINDEX_LINKAGE unsigned clang_visitChildren(CXTranslationUnit tu,
CINDEX_LINKAGE const char *clang_getFileName(CXFile SFile);
CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
/*
* CXEntity Operations.
*/
/* clang_getDeclaration() maps from a CXEntity to the matching CXDecl (if any)
* in a specified translation unit. */
CINDEX_LINKAGE CXDecl clang_getDeclaration(CXEntity, CXTranslationUnit);
/*
* CXDecl Operations.
*/
CINDEX_LINKAGE CXEntity clang_getEntityFromDecl(CXIndex, CXDecl);
/**
* \brief Identifies a specific source location within a translation
* unit.

View File

@ -20,9 +20,7 @@ _clang_getCursorLocation
_clang_getCursorReferenced
_clang_getCursorSpelling
_clang_getCursorUSR
_clang_getDeclaration
_clang_getDefinitionSpellingAndExtent
_clang_getEntityFromDecl
_clang_getFileName
_clang_getFileTime
_clang_getInstantiationLocation

View File

@ -17,48 +17,6 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
// Some notes on CXEntity:
//
// - Since the 'ordinary' namespace includes functions, data, typedefs,
// ObjC interfaces, thecurrent algorithm is a bit naive (resulting in one
// entity for 2 different types). For example:
//
// module1.m: @interface Foo @end Foo *x;
// module2.m: void Foo(int);
//
// - Since the unique name spans translation units, static data/functions
// within a CXTranslationUnit are *not* currently represented by entities.
// As a result, there will be no entity for the following:
//
// module.m: static void Foo() { }
//
static inline Entity GetEntity(const CXEntity &E) {
return Entity::getFromOpaquePtr(E.data);
}
static inline ASTUnit *GetTranslationUnit(CXTranslationUnit TU) {
return (ASTUnit*) TU;
}
static inline ASTContext &GetASTContext(CXTranslationUnit TU) {
return GetTranslationUnit(TU)->getASTContext();
}
static inline CXEntity NullCXEntity() {
CXEntity CE;
CE.index = NULL;
CE.data = NULL;
return CE;
}
static inline CXEntity MakeEntity(CXIndex CIdx, const Entity &E) {
CXEntity CE;
CE.index = CIdx;
CE.data = E.getAsOpaquePtr();
return CE;
}
static inline Program &GetProgram(CXIndex CIdx) {
return ((CIndexer*) CIdx)->getProgram();
}
@ -215,19 +173,6 @@ static CXString ConstructUSR(Decl *D) {
extern "C" {
/// clang_getDeclaration() maps from a CXEntity to the matching CXDecl (if any)
/// in a specified translation unit.
CXDecl clang_getDeclaration(CXEntity CE, CXTranslationUnit TU) {
return (CXDecl) GetEntity(CE).getDecl(GetASTContext(TU));
}
CXEntity clang_getEntityFromDecl(CXIndex CIdx, CXDecl CE) {
if (Decl *D = (Decl *) CE)
return MakeEntity(CIdx, Entity::get(D, GetProgram(CIdx)));
return NullCXEntity();
}
CXString clang_getCursorUSR(CXCursor C) {
if (Decl *D = cxcursor::getCursorDecl(C))
return ConstructUSR(D);