[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>
This commit is contained in:
parent
320f6820e3
commit
b4b150f8c9
14
clang/test/Driver/aix-default-target-triple.c
Normal file
14
clang/test/Driver/aix-default-target-triple.c
Normal file
@ -0,0 +1,14 @@
|
||||
// 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{{.*}}
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user