aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang-c/Index.h4
-rw-r--r--tools/CIndex/CIndex.cpp29
-rw-r--r--tools/CIndex/CIndex.exports2
-rw-r--r--tools/CIndex/CIndexUSRs.cpp46
-rw-r--r--tools/CIndex/CMakeLists.txt4
5 files changed, 52 insertions, 33 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 03b4df1259..8ff9f04dc8 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -322,8 +322,8 @@ CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
* 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.
*/
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 01a4cdd0ae..7b624e6dd3 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -529,35 +529,6 @@ void clang_loadDeclaration(CXDecl Dcl,
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.
//
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index e925df945d..2548c82940 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -35,7 +35,7 @@ _clang_getFileTime
_clang_getNullCursor
_clang_getNumCompletionChunks
_clang_getTranslationUnitSpelling
-_clang_getURI
+_clang_getUSR
_clang_isDeclaration
_clang_isDefinition
_clang_isInvalid
diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp
new file mode 100644
index 0000000000..40f93cd323
--- /dev/null
+++ b/tools/CIndex/CIndexUSRs.cpp
@@ -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"
diff --git a/tools/CIndex/CMakeLists.txt b/tools/CIndex/CMakeLists.txt
index ff3f4db2f4..52f847ef17 100644
--- a/tools/CIndex/CMakeLists.txt
+++ b/tools/CIndex/CMakeLists.txt
@@ -21,8 +21,10 @@ set( LLVM_LINK_COMPONENTS
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?