From 2dea7c4113dd982bdd845c09c94b0ae038d76256 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Mon, 25 Mar 2019 15:14:15 +0000 Subject: [PATCH] Python 2/3 compat: queue vs Queue Differential Revision: https://reviews.llvm.org/D59590 llvm-svn: 356905 --- llvm/tools/llvm-config/llvm-config.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index 7ef7c46..25f1c28 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -268,7 +268,6 @@ int main(int argc, char **argv) { // tree. bool IsInDevelopmentTree; enum { CMakeStyle, CMakeBuildModeStyle } DevelopmentTreeLayout; - llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0])); std::string CurrentExecPrefix; std::string ActiveObjRoot; @@ -279,11 +278,18 @@ int main(int argc, char **argv) { build_mode = CMAKE_CFG_INTDIR; #endif - // Create an absolute path, and pop up one directory (we expect to be inside a - // bin dir). - sys::fs::make_absolute(CurrentPath); - CurrentExecPrefix = - sys::path::parent_path(sys::path::parent_path(CurrentPath)).str(); + // Create an absolute path, and pop up as much directory as in + // LLVM_TOOLS_INSTALL_DIR + { + llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0])); + sys::fs::make_absolute(CurrentPath); + for (auto iter = sys::path::begin(LLVM_TOOLS_INSTALL_DIR), + end = sys::path::end(LLVM_TOOLS_INSTALL_DIR); + iter != end; ++iter) { + CurrentPath = sys::path::parent_path(CurrentPath).str(); + } + CurrentExecPrefix = sys::path::parent_path(CurrentPath).str(); + } // Check to see if we are inside a development tree by comparing to possible // locations (prefix style or CMake style). -- 2.7.4