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

Ted Kremenek kremenek at apple.com
Tue Jan 5 14:06:46 PST 2010


Author: kremenek
Date: Tue Jan  5 16:06:45 2010
New Revision: 92789

URL: http://llvm.org/viewvc/llvm-project?rev=92789&view=rev
Log:
Split (mostly nonexistent) USR code out from the main CIndex logic.

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

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

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Jan  5 16:06:45 2010
@@ -322,8 +322,8 @@
  * CXEntity Operations.
  */
 CINDEX_LINKAGE const char *clang_getDeclarationName(CXEntity);
-CINDEX_LINKAGE const char *clang_getURI(CXEntity);
-CINDEX_LINKAGE CXEntity clang_getEntity(const char *URI);
+CINDEX_LINKAGE const char *clang_getUSR(CXEntity);
+CINDEX_LINKAGE CXEntity clang_getEntity(const char *USR);
 /*
  * CXDecl Operations.
  */

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

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Tue Jan  5 16:06:45 2010
@@ -529,35 +529,6 @@
   DVisit.Visit(static_cast<Decl *>(Dcl));
 }
 
-// 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() { }
-//
-
-
-const char *clang_getDeclarationName(CXEntity) {
-  return "";
-}
-
-const char *clang_getURI(CXEntity) {
-  return "";
-}
-
-CXEntity clang_getEntity(const char *URI) {
-  return 0;
-}
-
 //
 // CXDecl Operations.
 //

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

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.exports (original)
+++ cfe/trunk/tools/CIndex/CIndex.exports Tue Jan  5 16:06:45 2010
@@ -35,7 +35,7 @@
 _clang_getNullCursor
 _clang_getNumCompletionChunks
 _clang_getTranslationUnitSpelling
-_clang_getURI
+_clang_getUSR
 _clang_isDeclaration
 _clang_isDefinition
 _clang_isInvalid

Added: cfe/trunk/tools/CIndex/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndexUSRs.cpp?rev=92789&view=auto

==============================================================================
--- cfe/trunk/tools/CIndex/CIndexUSRs.cpp (added)
+++ cfe/trunk/tools/CIndex/CIndexUSRs.cpp Tue Jan  5 16:06:45 2010
@@ -0,0 +1,46 @@
+//===- CIndexUSR.cpp - Clang-C Source Indexing Library --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the generation and use of USRs from CXEntities.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CIndexer.h"
+
+extern "C" {
+
+// 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() { }
+//
+
+const char *clang_getDeclarationName(CXEntity) {
+  return "";
+}
+
+const char *clang_getUSR(CXEntity) {
+  return "";
+}
+
+CXEntity clang_getEntity(const char *URI) {
+  return 0;
+}
+
+} // end extern "C"

Modified: cfe/trunk/tools/CIndex/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CMakeLists.txt?rev=92789&r1=92788&r2=92789&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CMakeLists.txt (original)
+++ cfe/trunk/tools/CIndex/CMakeLists.txt Tue Jan  5 16:06:45 2010
@@ -21,8 +21,10 @@
 
 add_clang_library(CIndex
   CIndex.cpp
+  CIndexCodeCompletion.cpp
+  CIndexUSRs.cpp
   CIndexer.cpp
-  CIndexCodeCompletion)
+)
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   # FIXME: Deal with LLVM_SUBMIT_VERSION?





More information about the cfe-commits mailing list