aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZaara Syeda <syzaara@ca.ibm.com>2024-03-28 08:37:25 -0400
committerGitHub <noreply@github.com>2024-03-28 08:37:25 -0400
commit4ddd4ed7fe15a356dace649e18492dd01071f475 (patch)
tree6c21c8bbd34affbc4a53a07ea172b16ca7b2fb93
parenta042fcbe45d1ae64acc5d818db90e26e16e1aab3 (diff)
downloadllvm-4ddd4ed7fe15a356dace649e18492dd01071f475.zip
llvm-4ddd4ed7fe15a356dace649e18492dd01071f475.tar.gz
llvm-4ddd4ed7fe15a356dace649e18492dd01071f475.tar.bz2
[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.
-rw-r--r--clang/lib/Driver/ToolChains/AIX.cpp6
-rw-r--r--clang/test/Driver/toc-conf.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp
index 6e08990..7a62b0f 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -471,7 +471,7 @@ static void addTocDataOptions(const llvm::opt::ArgList &Args,
// the global setting of tocdata in TOCDataGloballyinEffect.
// Those that have the opposite setting to TOCDataGloballyinEffect, are added
// to ExplicitlySpecifiedGlobals.
- llvm::StringSet<> ExplicitlySpecifiedGlobals;
+ std::set<llvm::StringRef> ExplicitlySpecifiedGlobals;
for (const auto Arg :
Args.filtered(options::OPT_mtocdata_EQ, options::OPT_mno_tocdata_EQ)) {
TOCDataSetting ArgTocDataSetting =
@@ -486,7 +486,7 @@ static void addTocDataOptions(const llvm::opt::ArgList &Args,
ExplicitlySpecifiedGlobals.erase(Val);
}
- auto buildExceptionList = [](const llvm::StringSet<> &ExplicitValues,
+ auto buildExceptionList = [](const std::set<llvm::StringRef> &ExplicitValues,
const char *OptionSpelling) {
std::string Option(OptionSpelling);
bool IsFirst = true;
@@ -495,7 +495,7 @@ static void addTocDataOptions(const llvm::opt::ArgList &Args,
Option += ",";
IsFirst = false;
- Option += E.first();
+ Option += E.str();
}
return Option;
};
diff --git a/clang/test/Driver/toc-conf.c b/clang/test/Driver/toc-conf.c
index 80d92ee..7b2d512 100644
--- a/clang/test/Driver/toc-conf.c
+++ b/clang/test/Driver/toc-conf.c
@@ -23,7 +23,7 @@ void func() {
// CHECK-CONF1-NOT: warning:
// CHECK-CONF1: "-cc1"{{.*}}" "-mno-tocdata"
-// CHECK-CONF1: "-mtocdata=g2,g1"
+// CHECK-CONF1: "-mtocdata=g1,g2"
// CHECK-CONF2-NOT: warning:
// CHECK-CONF2: "-cc1"{{.*}}" "-mtocdata"