xref: /openbsd-src/gnu/llvm/lldb/source/Commands/CommandObjectDWIMPrint.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1*f6aab3d8Srobert //===-- CommandObjectDWIMPrint.h --------------------------------*- C++ -*-===//
2*f6aab3d8Srobert //
3*f6aab3d8Srobert // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*f6aab3d8Srobert // See https://llvm.org/LICENSE.txt for license information.
5*f6aab3d8Srobert // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*f6aab3d8Srobert //
7*f6aab3d8Srobert //===----------------------------------------------------------------------===//
8*f6aab3d8Srobert 
9*f6aab3d8Srobert #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H
10*f6aab3d8Srobert #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H
11*f6aab3d8Srobert 
12*f6aab3d8Srobert #include "lldb/Interpreter/CommandObject.h"
13*f6aab3d8Srobert 
14*f6aab3d8Srobert namespace lldb_private {
15*f6aab3d8Srobert 
16*f6aab3d8Srobert /// Implements `dwim-print`, a printing command that chooses the most direct,
17*f6aab3d8Srobert /// efficient, and resilient means of printing a given expression.
18*f6aab3d8Srobert ///
19*f6aab3d8Srobert /// DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as:
20*f6aab3d8Srobert ///
21*f6aab3d8Srobert ///   > attempt to anticipate what users intend to do, correcting trivial errors
22*f6aab3d8Srobert ///   > automatically rather than blindly executing users' explicit but
23*f6aab3d8Srobert ///   > potentially incorrect input
24*f6aab3d8Srobert ///
25*f6aab3d8Srobert /// The `dwim-print` command serves as a single print command for users who
26*f6aab3d8Srobert /// don't yet know, or perfer not to know, the various lldb commands that can be
27*f6aab3d8Srobert /// used to print, and when to use them.
28*f6aab3d8Srobert class CommandObjectDWIMPrint : public CommandObjectRaw {
29*f6aab3d8Srobert public:
30*f6aab3d8Srobert   CommandObjectDWIMPrint(CommandInterpreter &interpreter);
31*f6aab3d8Srobert 
32*f6aab3d8Srobert   ~CommandObjectDWIMPrint() override = default;
33*f6aab3d8Srobert 
34*f6aab3d8Srobert private:
35*f6aab3d8Srobert   bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
36*f6aab3d8Srobert };
37*f6aab3d8Srobert 
38*f6aab3d8Srobert } // namespace lldb_private
39*f6aab3d8Srobert 
40*f6aab3d8Srobert #endif
41