c-index-test: Be available on Cygwin by using Win32's logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118479 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndexer.cpp b/tools/libclang/CIndexer.cpp
index baaeab3..95949b8 100644
--- a/tools/libclang/CIndexer.cpp
+++ b/tools/libclang/CIndexer.cpp
@@ -31,6 +31,11 @@
#include <vector>
#include <sstream>
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#define LLVM_ON_WIN32 1
+#endif
+
#ifdef LLVM_ON_WIN32
#include <windows.h>
#else
@@ -51,7 +56,13 @@
VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi,
sizeof(mbi));
GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
-
+
+#ifdef __CYGWIN__
+ char w32path[MAX_PATH];
+ strcpy(w32path, path);
+ cygwin_conv_to_full_posix_path(w32path, path);
+#endif
+
llvm::sys::Path LibClangPath(path);
LibClangPath.eraseComponent();
#else