1185d4964SDave Lee //===-- CommandObjectDWIMPrint.h --------------------------------*- C++ -*-===// 2185d4964SDave Lee // 3185d4964SDave Lee // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4185d4964SDave Lee // See https://llvm.org/LICENSE.txt for license information. 5185d4964SDave Lee // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6185d4964SDave Lee // 7185d4964SDave Lee //===----------------------------------------------------------------------===// 8185d4964SDave Lee 9185d4964SDave Lee #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H 10185d4964SDave Lee #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H 11185d4964SDave Lee 12920b46e1SDave Lee #include "CommandObjectExpression.h" 13185d4964SDave Lee #include "lldb/Interpreter/CommandObject.h" 14d160873cSDave Lee #include "lldb/Interpreter/OptionGroupFormat.h" 15d160873cSDave Lee #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" 16d160873cSDave Lee #include "lldb/Interpreter/OptionValueFormat.h" 17185d4964SDave Lee 18185d4964SDave Lee namespace lldb_private { 19185d4964SDave Lee 20185d4964SDave Lee /// Implements `dwim-print`, a printing command that chooses the most direct, 21185d4964SDave Lee /// efficient, and resilient means of printing a given expression. 22185d4964SDave Lee /// 23185d4964SDave Lee /// DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as: 24185d4964SDave Lee /// 25185d4964SDave Lee /// > attempt to anticipate what users intend to do, correcting trivial errors 26185d4964SDave Lee /// > automatically rather than blindly executing users' explicit but 27185d4964SDave Lee /// > potentially incorrect input 28185d4964SDave Lee /// 29185d4964SDave Lee /// The `dwim-print` command serves as a single print command for users who 30185d4964SDave Lee /// don't yet know, or perfer not to know, the various lldb commands that can be 31185d4964SDave Lee /// used to print, and when to use them. 32185d4964SDave Lee class CommandObjectDWIMPrint : public CommandObjectRaw { 33185d4964SDave Lee public: 34185d4964SDave Lee CommandObjectDWIMPrint(CommandInterpreter &interpreter); 35185d4964SDave Lee 36185d4964SDave Lee ~CommandObjectDWIMPrint() override = default; 37185d4964SDave Lee 38d160873cSDave Lee Options *GetOptions() override; 39d160873cSDave Lee WantsCompletion()408794712eSDave Lee bool WantsCompletion() override { return true; } 418794712eSDave Lee 42185d4964SDave Lee private: 43*92d8a28cSPete Lawrence void DoExecute(llvm::StringRef command, CommandReturnObject &result) override; 44d160873cSDave Lee 45d160873cSDave Lee OptionGroupOptions m_option_group; 46d160873cSDave Lee OptionGroupFormat m_format_options = lldb::eFormatDefault; 47d160873cSDave Lee OptionGroupValueObjectDisplay m_varobj_options; 48920b46e1SDave Lee CommandObjectExpression::CommandOptions m_expr_options; 49185d4964SDave Lee }; 50185d4964SDave Lee 51185d4964SDave Lee } // namespace lldb_private 52185d4964SDave Lee 53185d4964SDave Lee #endif 54