From 61593291fd6f94434dd834722adc89e68db125ab Mon Sep 17 00:00:00 2001 From: emankov Date: Sun, 6 Jan 2019 17:58:37 +0300 Subject: [PATCH] [HIPIFY][fix][#851] make_absolute only in case of relative path Otherwise return the input path. --- hipamd/hipify-clang/src/LLVMCompat.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hipamd/hipify-clang/src/LLVMCompat.cpp b/hipamd/hipify-clang/src/LLVMCompat.cpp index 22a0b56d64..95c8ab7837 100644 --- a/hipamd/hipify-clang/src/LLVMCompat.cpp +++ b/hipamd/hipify-clang/src/LLVMCompat.cpp @@ -21,6 +21,7 @@ THE SOFTWARE. */ #include "LLVMCompat.h" +#include "llvm/Support/Path.h" namespace llcompat { @@ -97,7 +98,13 @@ clang::SourceLocation getEndLoc(const clang::TypeLoc& typeLoc) { std::error_code real_path(const Twine &path, SmallVectorImpl &output, bool expand_tilde) { #if LLVM_VERSION_MAJOR < 5 - return sys::fs::make_absolute(path, output); + output.clear(); + std::string s = path.str(); + output.append(s.begin(), s.end()); + if (sys::path::is_relative(path)) { + return sys::fs::make_absolute(output); + } + return std::error_code(); #else return sys::fs::real_path(path, output, expand_tilde); #endif