Zaara Syeda 4ddd4ed7fe
[AIX][TOC] -mtocdata/-mno-tocdata fix non deterministic iteration order (#86840)
Failure with testcase toc-conf.c observed when building with
LLVM_REVERSE_ITERATION=ON.
Changing from using llvm::StringSet to std::set<llvm:StringRef> to
ensure iteration order is deterministic. Note: the functionality of the
feature does not require a specific iteration order, however, this will
allow testing to be consistent.
From llvm docs:
The advantages of std::set are that its iterators are stable (deleting
or inserting an element from the set does not affect iterators or
pointers to other elements) and that iteration over the set is
guaranteed to be in sorted order.
2024-03-28 08:37:25 -04:00

31 lines
1.3 KiB
C

// RUN: %clang %s --target=powerpc-unknown-aix -mno-tocdata -mtocdata -mno-tocdata -### 2>&1 | FileCheck %s -check-prefix=CHECK-FLAG1
// RUN: %clang %s --target=powerpc-unknown-aix -mno-tocdata -mtocdata -mno-tocdata -mtocdata -### 2>&1 | FileCheck %s -check-prefix=CHECK-FLAG2
// RUN: %clang %s --target=powerpc-unknown-aix -mtocdata=g1,g2 -mno-tocdata=g2 -mtocdata=g3,g4 -mno-tocdata=g5,g1 -### 2>&1 | FileCheck %s -check-prefix=CHECK-EQCONF
// RUN: %clang %s --target=powerpc-unknown-aix -mtocdata=g1 -mtocdata -mno-tocdata -mtocdata=g2,g3 -mno-tocdata=g4,g5,g3 -### 2>&1 | FileCheck %s -check-prefix=CHECK-CONF1
// RUN: %clang %s --target=powerpc-unknown-aix -mno-tocdata=g1 -mno-tocdata -mtocdata -### 2>&1 | FileCheck %s -check-prefix=CHECK-CONF2
int g1, g4, g5;
extern int g2;
int g3 = 0;
void func() {
g2 = 0;
}
// CHECK-FLAG1-NOT: warning:
// CHECK-FLAG1: "-cc1"{{.*}}" "-mno-tocdata"
// CHECK-FLAG2-NOT: warning:
// CHECK-FLAG2: "-cc1"{{.*}}" "-mtocdata"
// CHECK-EQCONF-NOT: warning:
// CHECK-EQCONF: "-cc1"{{.*}}" "-mno-tocdata"
// CHECK-EQCONF: "-mtocdata=g3,g4"
// CHECK-CONF1-NOT: warning:
// CHECK-CONF1: "-cc1"{{.*}}" "-mno-tocdata"
// CHECK-CONF1: "-mtocdata=g1,g2"
// CHECK-CONF2-NOT: warning:
// CHECK-CONF2: "-cc1"{{.*}}" "-mtocdata"
// CHECK-CONF2: "-mno-tocdata=g1"