[cfe-commits] r94039 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.exports tools/CIndex/CIndexUSRs.cpp

Douglas Gregor dgregor at apple.com
Wed Jan 20 14:14:23 PST 2010


Author: dgregor
Date: Wed Jan 20 16:14:22 2010
New Revision: 94039

URL: http://llvm.org/viewvc/llvm-project?rev=94039&view=rev
Log:
Kill CXEntity and CXDecl. The first has never been used, while the
second has been wholly replaced by cursors.


Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.exports
    cfe/trunk/tools/CIndex/CIndexUSRs.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=94039&r1=94038&r2=94039&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Jan 20 16:14:22 2010
@@ -54,7 +54,6 @@
 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 @@
   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 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.

Modified: cfe/trunk/tools/CIndex/CIndex.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.exports?rev=94039&r1=94038&r2=94039&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.exports (original)
+++ cfe/trunk/tools/CIndex/CIndex.exports Wed Jan 20 16:14:22 2010
@@ -20,9 +20,7 @@
 _clang_getCursorReferenced
 _clang_getCursorSpelling
 _clang_getCursorUSR
-_clang_getDeclaration
 _clang_getDefinitionSpellingAndExtent
-_clang_getEntityFromDecl
 _clang_getFileName
 _clang_getFileTime
 _clang_getInstantiationLocation

Modified: cfe/trunk/tools/CIndex/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndexUSRs.cpp?rev=94039&r1=94038&r2=94039&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndexUSRs.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndexUSRs.cpp Wed Jan 20 16:14:22 2010
@@ -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 @@
 
 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);  





More information about the cfe-commits mailing list