blob: 1e614a958c76786cd5f746be7ef54e9b91202208 [file] [log] [blame]
Zachary Turnerd37221d2014-07-09 16:31:49 +00001//===-- 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
15using namespace lldb;
16using namespace lldb_private;
17
Kate Stoneb9c1b512016-09-06 20:57:50 +000018bool 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 Turnerd37221d2014-07-09 16:31:49 +000029}
30
Kate Stoneb9c1b512016-09-06 20:57:50 +000031const char *PosixPlatformCommandOptionValidator::ShortConditionString() const {
32 return "POSIX";
Zachary Turnerd37221d2014-07-09 16:31:49 +000033}
34
Kate Stoneb9c1b512016-09-06 20:57:50 +000035const char *PosixPlatformCommandOptionValidator::LongConditionString() const {
36 return "Option only valid for POSIX-compliant hosts.";
Zachary Turnerd37221d2014-07-09 16:31:49 +000037}