[clang] f7ad7d1 - [Driver] Warn about all instances -mios-version-min not just the last

Cassie Jones via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 16 16:46:24 PDT 2023


Author: Cassie Jones
Date: 2023-07-16T16:45:49-07:00
New Revision: f7ad7d147b9c1e45e3f80f9e50be9984a8798e1a

URL: https://github.com/llvm/llvm-project/commit/f7ad7d147b9c1e45e3f80f9e50be9984a8798e1a
DIFF: https://github.com/llvm/llvm-project/commit/f7ad7d147b9c1e45e3f80f9e50be9984a8798e1a.diff

LOG: [Driver] Warn about all instances -mios-version-min not just the last

Follow-up to D155123, uniformly handle cases where there are duplicate
-mios-verion-min arguments.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D155407

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/test/Driver/macho-embedded.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 0f9474c45822f8..a73f46bb320294 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -87,7 +87,7 @@ void darwin::setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str,
       ArchKind == llvm::ARM::ArchKind::ARMV7EM) {
     // Don't reject -mios-version-min= if we have an iOS triple.
     if (T.isiOS())
-      if (Arg *A = Args.getLastArgNoClaim(options::OPT_mios_version_min_EQ))
+      for (Arg *A : Args.filtered(options::OPT_mios_version_min_EQ))
         A->ignoreTargetSpecific();
 
     T.setOS(llvm::Triple::UnknownOS);

diff  --git a/clang/test/Driver/macho-embedded.c b/clang/test/Driver/macho-embedded.c
index 6b93b967e25448..14b933ba256de0 100644
--- a/clang/test/Driver/macho-embedded.c
+++ b/clang/test/Driver/macho-embedded.c
@@ -7,6 +7,7 @@
 // RUN: %clang -arch armv7em -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED
 
 // RUN: %clang -arch armv7m --target=thumbv7-apple-ios -mios-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
+// RUN: %clang -arch armv7m --target=thumbv7-apple-ios -mios-version-min=5 -mios-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
 
 // CHECK-IOS: "-triple" "thumbv7" "thumbv7-apple-ios
 


        


More information about the cfe-commits mailing list