llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Tony Varghese (tonykuttai) <details> <summary>Changes</summary> PR #<!-- -->145685 introduced constructor overload ambiguity in the Triple class, causing `updateTripleOSVersion()` to construct Triple objects with `unknown` instead of the configured target triple (e.g., `powerpc-ibm-aix7.3.0.0`). This results in Clang driver errors like `error: unknown target triple 'unknown'`. Used `Twine` constructor with braced initialization to bypass ambiguity. --- Full diff: https://github.com/llvm/llvm-project/pull/147488.diff 2 Files Affected: - (added) clang/test/Driver/aix-default-target-triple.c (+18) - (modified) llvm/lib/TargetParser/Unix/Host.inc (+1-1) ``````````diff diff --git a/clang/test/Driver/aix-default-target-triple.c b/clang/test/Driver/aix-default-target-triple.c new file mode 100644 index 0000000000000..2802e6a60719a --- /dev/null +++ b/clang/test/Driver/aix-default-target-triple.c @@ -0,0 +1,18 @@ +// Test for the Triple constructor ambiguity fix on AIX +// This test verifies that the default target triple is correctly resolved +// and doesn't fall back to "unknown" due to constructor ambiguity. + +// REQUIRES: system-aix +// RUN: %clang -v %s -c 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET + +// Test that the target triple contains AIX and is not "unknown" +// The target should be something like "powerpc-ibm-aix7.3.0.0" +// CHECK-TARGET: Target: {{.*}}aix{{.*}} +// CHECK-TARGET-NOT: error: unknown target triple 'unknown' + +#include <stdio.h> + +int main() { + printf("Target triple resolution test passed\n"); + return 0; +} diff --git a/llvm/lib/TargetParser/Unix/Host.inc b/llvm/lib/TargetParser/Unix/Host.inc index ef9e288ee3a01..aeb2f59218700 100644 --- a/llvm/lib/TargetParser/Unix/Host.inc +++ b/llvm/lib/TargetParser/Unix/Host.inc @@ -55,7 +55,7 @@ static std::string updateTripleOSVersion(std::string TargetTripleString) { // On AIX, the AIX version and release should be that of the current host // unless if the version has already been specified. if (Triple(LLVM_HOST_TRIPLE).getOS() == Triple::AIX) { - Triple TT(std::move(TargetTripleString)); + Triple TT{TargetTripleString}; if (TT.getOS() == Triple::AIX && !TT.getOSMajorVersion()) { struct utsname name; if (uname(&name) != -1) { `````````` </details> https://github.com/llvm/llvm-project/pull/147488 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits