[llvm-branch-commits] [clang] 561be3b - [Driver] Fix a warning

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Aug 10 03:09:01 PDT 2024


Author: Kazu Hirata
Date: 2024-08-10T12:08:49+02:00
New Revision: 561be3b95e724a8df6f35c0b415b5f8a536a4df2

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

LOG: [Driver] Fix a warning

This patch fixes:

  clang/lib/Driver/ToolChains/Darwin.cpp:2937:3: error: default label
  in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

(cherry picked from commit 0f1361baf650641a59aaa1710d7a0b7b02f2e56d)

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Darwin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index b8b2feb5a149e..17d57b2f7eeda 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2927,14 +2927,12 @@ static bool sdkSupportsBuiltinModules(
     const Darwin::DarwinPlatformKind &TargetPlatform,
     const Darwin::DarwinEnvironmentKind &TargetEnvironment,
     const std::optional<DarwinSDKInfo> &SDKInfo) {
-  switch (TargetEnvironment) {
-  case Darwin::NativeEnvironment:
-  case Darwin::Simulator:
-  case Darwin::MacCatalyst:
+  if (TargetEnvironment == Darwin::NativeEnvironment ||
+      TargetEnvironment == Darwin::Simulator ||
+      TargetEnvironment == Darwin::MacCatalyst) {
     // Standard xnu/Mach/Darwin based environments
     // depend on the SDK version.
-    break;
-  default:
+  } else {
     // All other environments support builtin modules from the start.
     return true;
   }


        


More information about the llvm-branch-commits mailing list