Zachary Turner | d37221d | 2014-07-09 16:31:49 +0000 | [diff] [blame] | 1 | //===-- CommandOptionValidators.cpp -----------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "lldb/Interpreter/CommandOptionValidators.h" |
| 11 | |
| 12 | #include "lldb/Interpreter/CommandInterpreter.h" |
| 13 | #include "lldb/Target/Platform.h" |
| 14 | |
| 15 | using namespace lldb; |
| 16 | using namespace lldb_private; |
| 17 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 18 | bool PosixPlatformCommandOptionValidator::IsValid( |
| 19 | Platform &platform, const ExecutionContext &target) const { |
| 20 | llvm::Triple::OSType os = |
| 21 | platform.GetSystemArchitecture().GetTriple().getOS(); |
| 22 | switch (os) { |
| 23 | // Are there any other platforms that are not POSIX-compatible? |
| 24 | case llvm::Triple::Win32: |
| 25 | return false; |
| 26 | default: |
| 27 | return true; |
| 28 | } |
Zachary Turner | d37221d | 2014-07-09 16:31:49 +0000 | [diff] [blame] | 29 | } |
| 30 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 31 | const char *PosixPlatformCommandOptionValidator::ShortConditionString() const { |
| 32 | return "POSIX"; |
Zachary Turner | d37221d | 2014-07-09 16:31:49 +0000 | [diff] [blame] | 33 | } |
| 34 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 35 | const char *PosixPlatformCommandOptionValidator::LongConditionString() const { |
| 36 | return "Option only valid for POSIX-compliant hosts."; |
Zachary Turner | d37221d | 2014-07-09 16:31:49 +0000 | [diff] [blame] | 37 | } |