Find clang's binary include paths.

In cases where we do not have 'installed' clang we should try to find the
relevant include directories.
This commit is contained in:
Vassil Vassilev 2018-01-28 22:06:04 +01:00 committed by sftnight
parent bfb4168dc9
commit 47aa5c23ef

View File

@ -657,8 +657,17 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
P.resize(ExeIncl.size()); P.resize(ExeIncl.size());
// Get foo/include // Get foo/include
llvm::sys::path::append(P, "include"); llvm::sys::path::append(P, "include");
if (llvm::sys::fs::is_directory(P.str())) if (llvm::sys::fs::is_directory(P.str())) {
utils::AddIncludePaths(P.str(), HOpts, nullptr); utils::AddIncludePaths(P.str(), HOpts, nullptr);
llvm::sys::path::append(P, "clang");
if (!llvm::sys::fs::is_directory(P.str())) {
// LLVM is not installed. Try resolving clang from its usual location.
P = llvm::sys::path::parent_path(P);
llvm::sys::path::append(P, "..", "tools", "clang", "include");
if (llvm::sys::fs::is_directory(P.str()))
utils::AddIncludePaths(P.str(), HOpts, nullptr);
}
}
} }
} }