]> granicus.if.org Git - clang/commitdiff
Fix clang executable path for Windows
authorJohn Thompson <John.Thompson.JTSoftware@gmail.com>
Wed, 11 Nov 2009 23:11:14 +0000 (23:11 +0000)
committerJohn Thompson <John.Thompson.JTSoftware@gmail.com>
Wed, 11 Nov 2009 23:11:14 +0000 (23:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86896 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index da73ae40a396f19abc18e43ef4521594d40a8249..69cb52b485074f0d5625c0a76207e3ef9d22206e 100644 (file)
@@ -331,6 +331,11 @@ const llvm::sys::Path& CIndexer::getClangPath() {
   GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
 
   llvm::sys::Path CIndexPath(path);
+
+  CIndexPath.eraseComponent();
+  CIndexPath.appendComponent("clang");
+  CIndexPath.appendSuffix("exe");
+  CIndexPath.makeAbsolute();
 #else
   // This silly cast below avoids a C++ warning.
   Dl_info info;
@@ -338,13 +343,13 @@ const llvm::sys::Path& CIndexer::getClangPath() {
     assert(0 && "Call to dladdr() failed");
 
   llvm::sys::Path CIndexPath(info.dli_fname);
-#endif
 
   // We now have the CIndex directory, locate clang relative to it.
   CIndexPath.eraseComponent();
   CIndexPath.eraseComponent();
   CIndexPath.appendComponent("bin");
   CIndexPath.appendComponent("clang");
+#endif
 
   // Cache our result.
   ClangPath = CIndexPath;