Skip to content

[clang][Driver] Add support for XROS_DEPLOYMENT_TARGET env var #81011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

cyndyishida
Copy link
Member

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Feb 7, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 7, 2024

@llvm/pr-subscribers-clang-driver

Author: Cyndy Ishida (cyndyishida)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/81011.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Darwin.h (+1-1)
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 5e60b0841d6d5f..10d4b69e5d5f10 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -300,7 +300,7 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
     WatchOS,
     DriverKit,
     XROS,
-    LastDarwinPlatform = DriverKit
+    LastDarwinPlatform = XROS
   };
   enum DarwinEnvironmentKind {
     NativeEnvironment,

@llvmbot
Copy link
Member

llvmbot commented Feb 7, 2024

@llvm/pr-subscribers-clang

Author: Cyndy Ishida (cyndyishida)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/81011.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Darwin.h (+1-1)
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 5e60b0841d6d5f..10d4b69e5d5f10 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -300,7 +300,7 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
     WatchOS,
     DriverKit,
     XROS,
-    LastDarwinPlatform = DriverKit
+    LastDarwinPlatform = XROS
   };
   enum DarwinEnvironmentKind {
     NativeEnvironment,

@ributzka
Copy link
Collaborator

ributzka commented Feb 7, 2024

Why didn't this trigger:

static_assert(std::size(EnvVars) == Darwin::LastDarwinPlatform + 1,
?

@ributzka
Copy link
Collaborator

ributzka commented Feb 7, 2024

Why didn't this trigger:

static_assert(std::size(EnvVars) == Darwin::LastDarwinPlatform + 1,

?

XROS is missing in the env vars too:

const char *EnvVars[] = {

@cyndyishida
Copy link
Member Author

Why didn't this trigger:

static_assert(std::size(EnvVars) == Darwin::LastDarwinPlatform + 1,

?

XROS is missing in the env vars too:

const char *EnvVars[] = {

Yes. Adding proper XROS_DEPLOYMENT_TARGET support is a bigger patch, I'll need to update this PR to reflect this.

@cyndyishida cyndyishida force-pushed the eng/Pr-DarwinPlatxROS branch from a9c3775 to 5a60725 Compare February 7, 2024 18:42
@cyndyishida cyndyishida changed the title [clang] Fixup last value in DarwinPlatformKind enum [clang][Driver] Add support for XROS_DEPLOYMENT_TARGET env var Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff ab92f6274b7c3a4b4445d47017bc481aa919545f 5a60725a1abf5a56c4a482c56ea91990074ee17c -- clang/test/Driver/xros-driver-requires-darwin-host.c clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/Darwin.h
View the diff from clang-format here.
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index cc1219d69d..0ee2b074a4 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1897,13 +1897,9 @@ getDeploymentTargetFromEnvironmentVariables(const Driver &TheDriver,
                                             const llvm::Triple &Triple) {
   std::string Targets[Darwin::LastDarwinPlatform + 1];
   const char *EnvVars[] = {
-      "MACOSX_DEPLOYMENT_TARGET",
-      "IPHONEOS_DEPLOYMENT_TARGET",
-      "TVOS_DEPLOYMENT_TARGET",
-      "WATCHOS_DEPLOYMENT_TARGET",
-      "DRIVERKIT_DEPLOYMENT_TARGET",
-      "XROS_DEPLOYMENT_TARGET"
-  };
+      "MACOSX_DEPLOYMENT_TARGET",    "IPHONEOS_DEPLOYMENT_TARGET",
+      "TVOS_DEPLOYMENT_TARGET",      "WATCHOS_DEPLOYMENT_TARGET",
+      "DRIVERKIT_DEPLOYMENT_TARGET", "XROS_DEPLOYMENT_TARGET"};
   static_assert(std::size(EnvVars) == Darwin::LastDarwinPlatform + 1,
                 "Missing platform");
   for (const auto &I : llvm::enumerate(llvm::ArrayRef(EnvVars))) {

@cyndyishida
Copy link
Member Author

ping

Copy link
Collaborator

@ributzka ributzka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyndyishida cyndyishida merged commit 1245f5f into llvm:main Feb 9, 2024
@cyndyishida cyndyishida deleted the eng/Pr-DarwinPlatxROS branch February 9, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants