[HIPIFY][#1819] Fix for not found clang's system header files
Use absolute paths instead of relative ones.
[ROCm/clr commit: 5fae88f84b]
This commit is contained in:
@@ -108,7 +108,7 @@ void sortInputFiles(int argc, const char **argv, std::vector<std::string> &files
|
|||||||
files.assign(sortedFiles.begin(), sortedFiles.end());
|
files.assign(sortedFiles.begin(), sortedFiles.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendArgumentsAdjusters(ct::RefactoringTool &Tool, const std::string &sSourceAbsPath) {
|
void appendArgumentsAdjusters(ct::RefactoringTool &Tool, const std::string &sSourceAbsPath, const char *hipify_exe) {
|
||||||
if (!IncludeDirs.empty()) {
|
if (!IncludeDirs.empty()) {
|
||||||
for (std::string s : IncludeDirs) {
|
for (std::string s : IncludeDirs) {
|
||||||
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(s.c_str(), ct::ArgumentInsertPosition::BEGIN));
|
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(s.c_str(), ct::ArgumentInsertPosition::BEGIN));
|
||||||
@@ -122,9 +122,14 @@ void appendArgumentsAdjusters(ct::RefactoringTool &Tool, const std::string &sSou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Includes for clang's CUDA wrappers for using by packaged hipify-clang
|
// Includes for clang's CUDA wrappers for using by packaged hipify-clang
|
||||||
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("./include", ct::ArgumentInsertPosition::BEGIN));
|
static int Dummy;
|
||||||
|
std::string hipify = llvm::sys::fs::getMainExecutable(hipify_exe, (void *)&Dummy);
|
||||||
|
std::string clang_inc_path = llvm::sys::path::parent_path(hipify);
|
||||||
|
clang_inc_path.append("/include");
|
||||||
|
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(clang_inc_path.c_str(), ct::ArgumentInsertPosition::BEGIN));
|
||||||
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
|
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
|
||||||
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("./include/cuda_wrappers", ct::ArgumentInsertPosition::BEGIN));
|
clang_inc_path.append("/cuda_wrappers");
|
||||||
|
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(clang_inc_path.c_str(), ct::ArgumentInsertPosition::BEGIN));
|
||||||
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
|
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
|
||||||
// Ensure at least c++11 is used.
|
// Ensure at least c++11 is used.
|
||||||
std::string stdCpp = "-std=c++11";
|
std::string stdCpp = "-std=c++11";
|
||||||
@@ -315,7 +320,7 @@ int main(int argc, const char **argv) {
|
|||||||
ct::RefactoringTool Tool(OptionsParser.getCompilations(), std::string(tmpFile.c_str()));
|
ct::RefactoringTool Tool(OptionsParser.getCompilations(), std::string(tmpFile.c_str()));
|
||||||
ct::Replacements &replacementsToUse = llcompat::getReplacements(Tool, tmpFile.c_str());
|
ct::Replacements &replacementsToUse = llcompat::getReplacements(Tool, tmpFile.c_str());
|
||||||
ReplacementsFrontendActionFactory<HipifyAction> actionFactory(&replacementsToUse);
|
ReplacementsFrontendActionFactory<HipifyAction> actionFactory(&replacementsToUse);
|
||||||
appendArgumentsAdjusters(Tool, sSourceAbsPath);
|
appendArgumentsAdjusters(Tool, sSourceAbsPath, argv[0]);
|
||||||
Statistics ¤tStat = Statistics::current();
|
Statistics ¤tStat = Statistics::current();
|
||||||
// Hipify _all_ the things!
|
// Hipify _all_ the things!
|
||||||
if (Tool.runAndSave(&actionFactory)) {
|
if (Tool.runAndSave(&actionFactory)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user