1 //===-- CommandObjectDWIMPrint.h --------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H
10 #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H
12 #include "CommandObjectExpression.h"
13 #include "lldb/Interpreter/CommandObject.h"
14 #include "lldb/Interpreter/OptionGroupFormat.h"
15 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
16 #include "lldb/Interpreter/OptionValueFormat.h"
18 namespace lldb_private
{
20 /// Implements `dwim-print`, a printing command that chooses the most direct,
21 /// efficient, and resilient means of printing a given expression.
23 /// DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as:
25 /// > attempt to anticipate what users intend to do, correcting trivial errors
26 /// > automatically rather than blindly executing users' explicit but
27 /// > potentially incorrect input
29 /// The `dwim-print` command serves as a single print command for users who
30 /// don't yet know, or perfer not to know, the various lldb commands that can be
31 /// used to print, and when to use them.
32 class CommandObjectDWIMPrint
: public CommandObjectRaw
{
34 CommandObjectDWIMPrint(CommandInterpreter
&interpreter
);
36 ~CommandObjectDWIMPrint() override
= default;
38 Options
*GetOptions() override
;
40 bool WantsCompletion() override
{ return true; }
43 void DoExecute(llvm::StringRef command
, CommandReturnObject
&result
) override
;
45 OptionGroupOptions m_option_group
;
46 OptionGroupFormat m_format_options
= lldb::eFormatDefault
;
47 OptionGroupValueObjectDisplay m_varobj_options
;
48 CommandObjectExpression::CommandOptions m_expr_options
;
51 } // namespace lldb_private