diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/include/clang/Frontend/FrontendOptions.h @@ -16,9 +16,9 @@ #include "clang/Serialization/ModuleFileExtension.h" #include "llvm/ADT/StringRef.h" #include +#include #include #include -#include #include namespace llvm { @@ -404,7 +404,7 @@ std::string ActionName; /// Args to pass to the plugins - std::unordered_map> PluginArgs; + std::map> PluginArgs; /// The list of plugin actions to run in addition to the normal action. std::vector AddPluginActions; diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -877,4 +877,15 @@ 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