Skip to content

Commit 9d9ed1f

Browse files
author
Tony Varghese
committed
[PowerPC][clang] Fix triple constructor ambiguity causing "unknown" target triple on AIX
1 parent 74995a6 commit 9d9ed1f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
// CHECK-TARGET-NOT: error: unknown target triple 'unknown'
12+
13+
int main() {
14+
return 0;
15+
}

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)