Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,4 @@ else()
llvm_add_host_executable(build-timeit timeit timeit.c)
endif()

# FIXME: the iOS buildbots can't build this since it uses `std::system`, but
# since we don't support Fortram on the iOS bots and this utility is only used
# by Fortran tests, it effectively "reverts to green", without entirely
# reverting the patch.
#
# See: https://github.com/llvm/llvm-project/issues/77137
if(TEST_SUITE_FORTRAN)
add_executable(not ${CMAKE_CURRENT_SOURCE_DIR}/not.cpp)
endif()
add_executable(not ${CMAKE_CURRENT_SOURCE_DIR}/not.cpp)
20 changes: 17 additions & 3 deletions tools/not.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
#include <windows.h>
#endif

int main(int argc, const char **argv) {
#ifdef __APPLE__
#include <spawn.h>
#include <sys/wait.h>
#include <TargetConditionals.h>
#endif

int main(int argc, char* const* argv) {
bool expectCrash = false;

++argv;
Expand All @@ -49,13 +55,21 @@ int main(int argc, const char **argv) {
if (argc == 0)
return 1;

int result;
#if !defined(TARGET_OS_IPHONE)
std::stringstream ss;
ss << argv[0];
for (int i = 1; i < argc; ++i)
ss << " " << argv[i];
std::string cmd = ss.str();

int result = std::system(cmd.c_str());
result = std::system(cmd.c_str());
#else
pid_t pid;
if (posix_spawn(&pid, argv[0], NULL, NULL, argv, NULL))
return EXIT_FAILURE;
if (waitpid(pid, &result, WUNTRACED | WCONTINUED) == -1)
return EXIT_FAILURE;
#endif
int retcode = 0;
int signal = 0;

Expand Down