Skip to content

Commit 1fd1624

Browse files
authored
Merge pull request #70599 from DougGregor/cpp-driver-no-objc-in-embedded
Teach the C++ driver not to add `-enable-objc-interop` for Embedded Swift
2 parents f08f86c + 5909e75 commit 1fd1624

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ static void addLTOArgs(const OutputInfo &OI, ArgStringList &arguments) {
142142
}
143143
}
144144

145+
namespace {
146+
147+
template<typename Container>
148+
bool containsValue(
149+
const Container &container,
150+
typename Container::value_type const &element
151+
) {
152+
for (const auto &value : container) {
153+
if (value == element)
154+
return true;
155+
}
156+
157+
return false;
158+
}
159+
160+
}
145161

146162
void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
147163
const CommandOutput &output,
@@ -177,7 +193,11 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
177193
}
178194

179195
// Enable or disable ObjC interop appropriately for the platform
180-
if (Triple.isOSDarwin()) {
196+
if (Triple.isOSDarwin() &&
197+
!containsValue(
198+
inputArgs
199+
.getAllArgValues(options::OPT_enable_experimental_feature),
200+
"Embedded")) {
181201
arguments.push_back("-enable-objc-interop");
182202
} else {
183203
arguments.push_back("-disable-objc-interop");

0 commit comments

Comments
 (0)