From: Ted Kremenek Date: Tue, 5 Jan 2010 22:06:45 +0000 (+0000) Subject: Split (mostly nonexistent) USR code out from the main CIndex logic. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b6869a1831ef66b5024dd23160dc9519c99555d;p=clang Split (mostly nonexistent) USR code out from the main CIndex logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92789 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(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?