1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

Fix CLang Toolchain enablement

- Fix LlvmEnvironmentVariableSupplier.getDirIfLlvmFound method
  which was not bothering to look for llvm-ar in the user's path
  because it would only set its internal llvmPath variable if
  directories ended in '/' or if a subdir was provided which is
  not the case for it being called from LlvmToolChainSupported
- set the llvmPath to the candidatePath at the beginning so the
  test will be performed

Change-Id: I4b93fb3e569c32cff580c57dbedbe730dbbe057e
This commit is contained in:
Jeff Johnston 2015-04-09 15:23:05 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 84a53f8d80
commit 61200ab252

View file

@ -260,18 +260,16 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
* @return Full path for LLVM executable if valid, otherwise null
*/
private static String getDirIfLlvmFound(String candidatePath, String subPath) {
String llvmPath = null;
String llvmPath = candidatePath;
// If there is a trailing / or \, remove it
if (candidatePath.endsWith(Separators.getFileSeparator()) && candidatePath.length() > 1) {
llvmPath = candidatePath.substring(0, candidatePath.length() - 1);
if (llvmPath.endsWith(Separators.getFileSeparator()) && llvmPath.length() > 1) {
llvmPath = llvmPath.substring(0, candidatePath.length() - 1);
}
// If subPath exists and is not empty -> append it to candidatePath.
if (null != subPath && !subPath.isEmpty()) {
// Form full path.
llvmPath = candidatePath + Separators.getFileSeparator() + subPath;
llvmPath = llvmPath + Separators.getFileSeparator() + subPath;
}
if (llvmPath == null)
return null;
// Return a full path for LLVM executable if it's valid, otherwise null.
return getBinDirIfLlvm_ar(llvmPath);
}