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