MaskRay created this revision. MaskRay added reviewers: atanasyan, doko, nathanchance, nickdesaulniers, sylvestre.ledru, vkalintiris. Herald added subscribers: arichardson, sdardis. MaskRay requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
D13340 <https://reviews.llvm.org/D13340> introduced this behavior which is not needed even for mips. This was raised on https://lists.llvm.org/pipermail/cfe-dev/2020-May/065437.html but no action was taken. This was raised again in a thread "The LLVM host/target TRIPLE padding drama on Debian" as it caused confusion. This patch drops the behavior. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D99996 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/program-path-priority.c Index: clang/test/Driver/program-path-priority.c =================================================================== --- clang/test/Driver/program-path-priority.c +++ clang/test/Driver/program-path-priority.c @@ -3,8 +3,7 @@ /// Check the priority used when searching for tools /// Names and locations are usually in this order: -/// <triple>-tool, tool, <default triple>-tool -/// program path, PATH +/// <triple>-tool, tool, program path, PATH /// (from highest to lowest priority) /// A higher priority name found in a lower priority /// location will win over a lower priority name in a @@ -102,13 +101,11 @@ // DEFAULT_TRIPLE_NO_NOTREAL: env/gcc" // DEFAULT_TRIPLE_NO_NOTREAL-NOT: -gcc" -/// default triple only chosen when no others are present +/// Pick "gcc" as a fallback. Don't pick $DEFAULT_TRIPLE-gcc. // RUN: rm %t/env/gcc // RUN: env "PATH=%t/env/" %t/clang -### -target notreal-none-elf %s 2>&1 | \ // RUN: FileCheck --check-prefix=DEFAULT_TRIPLE_NO_OTHERS %s -// DEFAULT_TRIPLE_NO_OTHERS: -gcc" -// DEFAULT_TRIPLE_NO_OTHERS-NOT: notreal-none-elf-gcc" -// DEFAULT_TRIPLE_NO_OTHERS-NOT: /gcc" +// DEFAULT_TRIPLE_NO_OTHERS: "gcc" /// -B paths are searched separately so default triple will win /// if put in one of those even if other paths have higher priority names Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -5070,11 +5070,6 @@ // FIXME: Needs a better variable than TargetTriple Names.emplace_back((TargetTriple + "-" + Tool).str()); Names.emplace_back(Tool); - - // Allow the discovery of tools prefixed with LLVM's default target triple. - std::string DefaultTargetTriple = llvm::sys::getDefaultTargetTriple(); - if (DefaultTargetTriple != TargetTriple) - Names.emplace_back((DefaultTargetTriple + "-" + Tool).str()); } static bool ScanDirForExecutable(SmallString<128> &Dir, StringRef Name) {
Index: clang/test/Driver/program-path-priority.c =================================================================== --- clang/test/Driver/program-path-priority.c +++ clang/test/Driver/program-path-priority.c @@ -3,8 +3,7 @@ /// Check the priority used when searching for tools /// Names and locations are usually in this order: -/// <triple>-tool, tool, <default triple>-tool -/// program path, PATH +/// <triple>-tool, tool, program path, PATH /// (from highest to lowest priority) /// A higher priority name found in a lower priority /// location will win over a lower priority name in a @@ -102,13 +101,11 @@ // DEFAULT_TRIPLE_NO_NOTREAL: env/gcc" // DEFAULT_TRIPLE_NO_NOTREAL-NOT: -gcc" -/// default triple only chosen when no others are present +/// Pick "gcc" as a fallback. Don't pick $DEFAULT_TRIPLE-gcc. // RUN: rm %t/env/gcc // RUN: env "PATH=%t/env/" %t/clang -### -target notreal-none-elf %s 2>&1 | \ // RUN: FileCheck --check-prefix=DEFAULT_TRIPLE_NO_OTHERS %s -// DEFAULT_TRIPLE_NO_OTHERS: -gcc" -// DEFAULT_TRIPLE_NO_OTHERS-NOT: notreal-none-elf-gcc" -// DEFAULT_TRIPLE_NO_OTHERS-NOT: /gcc" +// DEFAULT_TRIPLE_NO_OTHERS: "gcc" /// -B paths are searched separately so default triple will win /// if put in one of those even if other paths have higher priority names Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -5070,11 +5070,6 @@ // FIXME: Needs a better variable than TargetTriple Names.emplace_back((TargetTriple + "-" + Tool).str()); Names.emplace_back(Tool); - - // Allow the discovery of tools prefixed with LLVM's default target triple. - std::string DefaultTargetTriple = llvm::sys::getDefaultTargetTriple(); - if (DefaultTargetTriple != TargetTriple) - Names.emplace_back((DefaultTargetTriple + "-" + Tool).str()); } static bool ScanDirForExecutable(SmallString<128> &Dir, StringRef Name) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits