1*0b57cec5SDimitry Andric //===-- CommandOptionValidators.cpp ---------------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "lldb/Interpreter/CommandOptionValidators.h"
10*0b57cec5SDimitry Andric 
11*0b57cec5SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h"
12*0b57cec5SDimitry Andric #include "lldb/Target/Platform.h"
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric using namespace lldb;
15*0b57cec5SDimitry Andric using namespace lldb_private;
16*0b57cec5SDimitry Andric 
IsValid(Platform & platform,const ExecutionContext & target) const17*0b57cec5SDimitry Andric bool PosixPlatformCommandOptionValidator::IsValid(
18*0b57cec5SDimitry Andric     Platform &platform, const ExecutionContext &target) const {
19*0b57cec5SDimitry Andric   llvm::Triple::OSType os =
20*0b57cec5SDimitry Andric       platform.GetSystemArchitecture().GetTriple().getOS();
21*0b57cec5SDimitry Andric   switch (os) {
22*0b57cec5SDimitry Andric   // Are there any other platforms that are not POSIX-compatible?
23*0b57cec5SDimitry Andric   case llvm::Triple::Win32:
24*0b57cec5SDimitry Andric     return false;
25*0b57cec5SDimitry Andric   default:
26*0b57cec5SDimitry Andric     return true;
27*0b57cec5SDimitry Andric   }
28*0b57cec5SDimitry Andric }
29*0b57cec5SDimitry Andric 
ShortConditionString() const30*0b57cec5SDimitry Andric const char *PosixPlatformCommandOptionValidator::ShortConditionString() const {
31*0b57cec5SDimitry Andric   return "POSIX";
32*0b57cec5SDimitry Andric }
33*0b57cec5SDimitry Andric 
LongConditionString() const34*0b57cec5SDimitry Andric const char *PosixPlatformCommandOptionValidator::LongConditionString() const {
35*0b57cec5SDimitry Andric   return "Option only valid for POSIX-compliant hosts.";
36*0b57cec5SDimitry Andric }
37