Author: Adrian Prantl Date: 2020-03-20T16:41:59-07:00 New Revision: 0e916bf9f5e4a51af621fd72ccf4b00b7e6f86fa
URL: https://github.com/llvm/llvm-project/commit/0e916bf9f5e4a51af621fd72ccf4b00b7e6f86fa DIFF: https://github.com/llvm/llvm-project/commit/0e916bf9f5e4a51af621fd72ccf4b00b7e6f86fa.diff LOG: Driver: Improve performance of getSDKName() The ".sdk" component is usually the last one in the -isysroot, so it makes more sense to scan from the back. Also, technically, someone could install Xcode into a directory ending with .sdk, which would break this heuristic. Differential Revision: https://reviews.llvm.org/D76097 Added: Modified: clang/lib/Driver/ToolChains/Darwin.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index ab3a68b70f5d..a5c08b405914 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1068,8 +1068,8 @@ StringRef Darwin::getPlatformFamily() const { StringRef Darwin::getSDKName(StringRef isysroot) { // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk - auto BeginSDK = llvm::sys::path::begin(isysroot); - auto EndSDK = llvm::sys::path::end(isysroot); + auto BeginSDK = llvm::sys::path::rbegin(isysroot); + auto EndSDK = llvm::sys::path::rend(isysroot); for (auto IT = BeginSDK; IT != EndSDK; ++IT) { StringRef SDK = *IT; if (SDK.endswith(".sdk")) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits