summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/CIndex/CMakeLists.txt1
-rw-r--r--clang/tools/CMakeLists.txt5
-rw-r--r--clang/tools/c-index-test/c-index-test.c16
3 files changed, 18 insertions, 4 deletions
diff --git a/clang/tools/CIndex/CMakeLists.txt b/clang/tools/CIndex/CMakeLists.txt
index ee77c0398f7..dd0eeea9443 100644
--- a/clang/tools/CIndex/CMakeLists.txt
+++ b/clang/tools/CIndex/CMakeLists.txt
@@ -26,6 +26,7 @@ if(MSVC)
# windows.h doesn't compile with /Za
get_target_property(NON_ANSI_COMPILE_FLAGS CIndex COMPILE_FLAGS)
string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
+ set(NON_ANSI_COMPILE_FLAGS "${NON_ANSI_COMPILE_FLAGS} /D_CINDEX_LIB_")
set_target_properties(CIndex PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
endif(MSVC)
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index cb2aa2004ce..222512af154 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -6,7 +6,4 @@ if (CLANG_BUILD_EXPERIMENTAL)
add_subdirectory(wpa)
endif ()
add_subdirectory(CIndex)
-if (MSVC)
-else ()
- add_subdirectory(c-index-test)
-endif ()
+add_subdirectory(c-index-test)
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index cf2a706891e..56b29ac136f 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -4,7 +4,23 @@
#include <stdio.h>
#include <string.h>
+#ifdef _MSC_VER
+char *basename(const char* path)
+{
+ char* base1 = (char*)strrchr(path, '/');
+ char* base2 = (char*)strrchr(path, '\\');
+ if (base1 && base2)
+ return((base1 > base2) ? base1 + 1 : base2 + 1);
+ else if (base1)
+ return(base1 + 1);
+ else if (base2)
+ return(base2 + 1);
+
+ return((char*)path);
+}
+#else
extern char *basename(const char *);
+#endif
static void PrintCursor(CXCursor Cursor) {
if (clang_isInvalid(Cursor.kind))
OpenPOWER on IntegriCloud