diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2021-04-05 12:15:50 +0200 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2021-04-06 09:24:42 +0200 |
commit | cc26943313def7a985f72eadc7499ac981daabc6 (patch) | |
tree | 3dbe8324ad8247dc2a748a441527054623fdcec9 /clang/unittests/Frontend/CompilerInvocationTest.cpp | |
parent | 98742e42fc50f58d3f2d3f2cdbbf540288c134b9 (diff) | |
download | llvm-cc26943313def7a985f72eadc7499ac981daabc6.zip llvm-cc26943313def7a985f72eadc7499ac981daabc6.tar.gz llvm-cc26943313def7a985f72eadc7499ac981daabc6.tar.bz2 |
[clang][cli] Ensure plugin args are generated in deterministic order
The '-plugin-arg' command-line arguments are not being generated in deterministic order.
This patch changes the storage from `std::unordered_map` to `std::map` to enforce ordering.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D99879
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
-rw-r--r-- | clang/unittests/Frontend/CompilerInvocationTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index b846e6e..066d02b 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -877,4 +877,15 @@ TEST_F(CommandLineTest, RoundTrip) { ShowIncludesDestination::Stdout); ASSERT_TRUE(Invocation.getDependencyOutputOpts().ShowHeaderIncludes); } + +TEST_F(CommandLineTest, PluginArgsRoundTripDeterminism) { + const char *Args[] = { + "-plugin-arg-blink-gc-plugin", "no-members-in-stack-allocated", + "-plugin-arg-find-bad-constructs", "checked-ptr-as-trivial-member", + "-plugin-arg-find-bad-constructs", "check-ipc", + // Enable round-trip to ensure '-plugin-arg' generation is deterministic. + "-round-trip-args"}; + + ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); +} } // anonymous namespace |