Skip to content

Commit b4b150f

Browse files
tonykuttaiTony Varghesearsenm
authored
[PowerPC][clang] Fix triple constructor ambiguity causing "unknown" target triple on AIX (#147488)
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. --------- Co-authored-by: Tony Varghese <tony.varghese@ibm.com> Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
1 parent 320f682 commit b4b150f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test for the Triple constructor ambiguity fix on AIX
2+
// This test verifies that the default target triple is correctly resolved
3+
// and doesn't fall back to "unknown" due to constructor ambiguity.
4+
5+
// REQUIRES: system-aix
6+
// RUN: %clang -v %s -c 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET
7+
8+
// Test that the target triple contains AIX and is not "unknown"
9+
// The target should be something like "powerpc-ibm-aix7.3.0.0"
10+
// CHECK-TARGET: Target: {{.*}}aix{{.*}}
11+
12+
int main() {
13+
return 0;
14+
}

llvm/lib/TargetParser/Unix/Host.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static std::string updateTripleOSVersion(std::string TargetTripleString) {
5555
// On AIX, the AIX version and release should be that of the current host
5656
// unless if the version has already been specified.
5757
if (Triple(LLVM_HOST_TRIPLE).getOS() == Triple::AIX) {
58-
Triple TT(std::move(TargetTripleString));
58+
Triple TT{TargetTripleString};
5959
if (TT.getOS() == Triple::AIX && !TT.getOSMajorVersion()) {
6060
struct utsname name;
6161
if (uname(&name) != -1) {

0 commit comments

Comments
 (0)