xref: /freebsd-src/contrib/llvm-project/lldb/source/Interpreter/CommandOptionValidators.cpp (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
1*5ffd83dbSDimitry Andric //===-- CommandOptionValidators.cpp ---------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "lldb/Interpreter/CommandOptionValidators.h"
100b57cec5SDimitry Andric 
110b57cec5SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h"
120b57cec5SDimitry Andric #include "lldb/Target/Platform.h"
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric using namespace lldb;
150b57cec5SDimitry Andric using namespace lldb_private;
160b57cec5SDimitry Andric 
IsValid(Platform & platform,const ExecutionContext & target) const170b57cec5SDimitry Andric bool PosixPlatformCommandOptionValidator::IsValid(
180b57cec5SDimitry Andric     Platform &platform, const ExecutionContext &target) const {
190b57cec5SDimitry Andric   llvm::Triple::OSType os =
200b57cec5SDimitry Andric       platform.GetSystemArchitecture().GetTriple().getOS();
210b57cec5SDimitry Andric   switch (os) {
220b57cec5SDimitry Andric   // Are there any other platforms that are not POSIX-compatible?
230b57cec5SDimitry Andric   case llvm::Triple::Win32:
240b57cec5SDimitry Andric     return false;
250b57cec5SDimitry Andric   default:
260b57cec5SDimitry Andric     return true;
270b57cec5SDimitry Andric   }
280b57cec5SDimitry Andric }
290b57cec5SDimitry Andric 
ShortConditionString() const300b57cec5SDimitry Andric const char *PosixPlatformCommandOptionValidator::ShortConditionString() const {
310b57cec5SDimitry Andric   return "POSIX";
320b57cec5SDimitry Andric }
330b57cec5SDimitry Andric 
LongConditionString() const340b57cec5SDimitry Andric const char *PosixPlatformCommandOptionValidator::LongConditionString() const {
350b57cec5SDimitry Andric   return "Option only valid for POSIX-compliant hosts.";
360b57cec5SDimitry Andric }
37