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