xref: /openbsd-src/gnu/llvm/lldb/source/Interpreter/CommandOptionValidators.cpp (revision dda2819751e49c83612958492e38917049128b41)
1*dda28197Spatrick //===-- CommandOptionValidators.cpp ---------------------------------------===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9061da546Spatrick #include "lldb/Interpreter/CommandOptionValidators.h"
10061da546Spatrick 
11061da546Spatrick #include "lldb/Interpreter/CommandInterpreter.h"
12061da546Spatrick #include "lldb/Target/Platform.h"
13061da546Spatrick 
14061da546Spatrick using namespace lldb;
15061da546Spatrick using namespace lldb_private;
16061da546Spatrick 
IsValid(Platform & platform,const ExecutionContext & target) const17061da546Spatrick bool PosixPlatformCommandOptionValidator::IsValid(
18061da546Spatrick     Platform &platform, const ExecutionContext &target) const {
19061da546Spatrick   llvm::Triple::OSType os =
20061da546Spatrick       platform.GetSystemArchitecture().GetTriple().getOS();
21061da546Spatrick   switch (os) {
22061da546Spatrick   // Are there any other platforms that are not POSIX-compatible?
23061da546Spatrick   case llvm::Triple::Win32:
24061da546Spatrick     return false;
25061da546Spatrick   default:
26061da546Spatrick     return true;
27061da546Spatrick   }
28061da546Spatrick }
29061da546Spatrick 
ShortConditionString() const30061da546Spatrick const char *PosixPlatformCommandOptionValidator::ShortConditionString() const {
31061da546Spatrick   return "POSIX";
32061da546Spatrick }
33061da546Spatrick 
LongConditionString() const34061da546Spatrick const char *PosixPlatformCommandOptionValidator::LongConditionString() const {
35061da546Spatrick   return "Option only valid for POSIX-compliant hosts.";
36061da546Spatrick }
37