forked from OSchip/llvm-project
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:
parent
401982f56c
commit
721e82edbc
|
@ -54,7 +54,6 @@ typedef void *CXIndex; /* An indexing instance. */
|
||||||
typedef void *CXTranslationUnit; /* A translation unit instance. */
|
typedef void *CXTranslationUnit; /* A translation unit instance. */
|
||||||
|
|
||||||
typedef void *CXFile; /* A source file */
|
typedef void *CXFile; /* A source file */
|
||||||
typedef void *CXDecl; /* A specific declaration within a translation unit. */
|
|
||||||
|
|
||||||
/* Cursors represent declarations, definitions, and references. */
|
/* Cursors represent declarations, definitions, and references. */
|
||||||
enum CXCursorKind {
|
enum CXCursorKind {
|
||||||
|
@ -219,12 +218,6 @@ typedef struct {
|
||||||
void *data[3];
|
void *data[3];
|
||||||
} CXCursor;
|
} 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
|
* For functions returning a string that might or might not need
|
||||||
* to be internally allocated and freed.
|
* 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 const char *clang_getFileName(CXFile SFile);
|
||||||
CINDEX_LINKAGE time_t clang_getFileTime(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
|
* \brief Identifies a specific source location within a translation
|
||||||
* unit.
|
* unit.
|
||||||
|
|
|
@ -20,9 +20,7 @@ _clang_getCursorLocation
|
||||||
_clang_getCursorReferenced
|
_clang_getCursorReferenced
|
||||||
_clang_getCursorSpelling
|
_clang_getCursorSpelling
|
||||||
_clang_getCursorUSR
|
_clang_getCursorUSR
|
||||||
_clang_getDeclaration
|
|
||||||
_clang_getDefinitionSpellingAndExtent
|
_clang_getDefinitionSpellingAndExtent
|
||||||
_clang_getEntityFromDecl
|
|
||||||
_clang_getFileName
|
_clang_getFileName
|
||||||
_clang_getFileTime
|
_clang_getFileTime
|
||||||
_clang_getInstantiationLocation
|
_clang_getInstantiationLocation
|
||||||
|
|
|
@ -17,48 +17,6 @@
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/Support/raw_ostream.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) {
|
static inline Program &GetProgram(CXIndex CIdx) {
|
||||||
return ((CIndexer*) CIdx)->getProgram();
|
return ((CIndexer*) CIdx)->getProgram();
|
||||||
}
|
}
|
||||||
|
@ -215,19 +173,6 @@ static CXString ConstructUSR(Decl *D) {
|
||||||
|
|
||||||
extern "C" {
|
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) {
|
CXString clang_getCursorUSR(CXCursor C) {
|
||||||
if (Decl *D = cxcursor::getCursorDecl(C))
|
if (Decl *D = cxcursor::getCursorDecl(C))
|
||||||
return ConstructUSR(D);
|
return ConstructUSR(D);
|
||||||
|
|
Loading…
Reference in New Issue