Skip to content

Commit f73223a

Browse files
committed
swift-reflection-test: Guard Mach-specific remote tests
These won't build on Linux.
1 parent 0e6dd78 commit f73223a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/swift-reflection-test/swift-reflection-test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
#include "llvm/Object/ELF.h"
2222
#include "llvm/Support/CommandLine.h"
2323

24+
#if __APPLE__
2425
#include "mach_messages.h"
2526
#include "mach_helpers.h"
27+
#endif
2628

2729
#include <iostream>
2830
#include <csignal>
@@ -196,6 +198,8 @@ static int doDumpReflectionSections(std::string BinaryFilename,
196198
return EXIT_SUCCESS;
197199
}
198200

201+
#if __APPLE__
202+
199203
static mach_port_t createReceivePort() {
200204
kern_return_t error;
201205
mach_port_t port = MACH_PORT_NULL;
@@ -425,14 +429,22 @@ static int doDumpHeapInstance(std::string BinaryFilename) {
425429
return EXIT_SUCCESS;
426430
}
427431

432+
#endif // __APPLE__
433+
428434
int main(int argc, char *argv[]) {
429435
llvm::cl::ParseCommandLineOptions(argc, argv, "Swift Reflection Test\n");
430436
switch (options::Action) {
431437
case ActionType::DumpReflectionSections:
432438
return doDumpReflectionSections(options::BinaryFilename,
433439
options::Architecture);
434440
case ActionType::DumpHeapInstance:
441+
#if __APPLE__
435442
return doDumpHeapInstance(options::BinaryFilename);
443+
#else
444+
std::cerr << "Dumping heap instances not available on this platform";
445+
std::cerr << std::endl;
446+
return EXIT_FAILURE;
447+
#endif
436448
case ActionType::None:
437449
llvm::cl::PrintHelpMessage();
438450
return EXIT_FAILURE;

0 commit comments

Comments
 (0)