[clang] [clang] deduplicate target-features for modules (PR #187614)

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 15:53:04 PDT 2026


================
@@ -495,7 +495,10 @@ static bool checkTargetOptions(const TargetOptions &TargetOpts,
   SmallVector<StringRef, 4> ReadFeatures(TargetOpts.FeaturesAsWritten.begin(),
                                          TargetOpts.FeaturesAsWritten.end());
   llvm::sort(ExistingFeatures);
+  ExistingFeatures.erase(llvm::unique(ExistingFeatures),
+                         ExistingFeatures.end());
   llvm::sort(ReadFeatures);
+  ReadFeatures.erase(llvm::unique(ReadFeatures), ReadFeatures.end());
----------------
Bigcheese wrote:

I would prefer we unique these during AST writing, or even in the `CompilerInvocation` directly. That would also handle the case for dependency scanning.

https://github.com/llvm/llvm-project/pull/187614


More information about the cfe-commits mailing list