From: Davide Italiano Date: Fri, 23 Mar 2018 20:58:05 +0000 (+0000) Subject: [Command] Remove dead code for the syntax command. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd679c0e2279d24508917fc7bb6a79e1c1f3c481;p=platform%2Fupstream%2Fllvm.git [Command] Remove dead code for the syntax command. I'm going to add a new commend so I figured I could do some spring cleaning. llvm-svn: 328368 --- diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 1dd79d6..535a1b8 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -396,7 +396,6 @@ 2689002313353DDE00698AC0 /* CommandObjectScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */; }; 2689002413353DDE00698AC0 /* CommandObjectSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */; }; 2689002513353DDE00698AC0 /* CommandObjectSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */; }; - 2689002613353DDE00698AC0 /* CommandObjectSyntax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */; }; 2689002713353DDE00698AC0 /* CommandObjectTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */; }; 2689002813353DDE00698AC0 /* CommandObjectThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */; }; 2689002913353DDE00698AC0 /* CommandObjectVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */; }; @@ -2114,7 +2113,6 @@ 26BC7D2410F1B76300F91463 /* CommandObjectScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectScript.h; path = source/Interpreter/CommandObjectScript.h; sourceTree = ""; }; 26BC7D2710F1B76300F91463 /* CommandObjectSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSettings.h; path = source/Commands/CommandObjectSettings.h; sourceTree = ""; }; 26BC7D2910F1B76300F91463 /* CommandObjectSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSource.h; path = source/Commands/CommandObjectSource.h; sourceTree = ""; }; - 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSyntax.h; path = source/Commands/CommandObjectSyntax.h; sourceTree = ""; }; 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree = ""; }; 26BC7D5010F1B77400F91463 /* Address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Address.h; path = include/lldb/Core/Address.h; sourceTree = ""; }; 26BC7D5110F1B77400F91463 /* AddressRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressRange.h; path = include/lldb/Core/AddressRange.h; sourceTree = ""; }; @@ -2197,7 +2195,6 @@ 26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectScript.cpp; path = source/Interpreter/CommandObjectScript.cpp; sourceTree = ""; }; 26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSettings.cpp; path = source/Commands/CommandObjectSettings.cpp; sourceTree = ""; }; 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSource.cpp; path = source/Commands/CommandObjectSource.cpp; sourceTree = ""; }; - 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSyntax.cpp; path = source/Commands/CommandObjectSyntax.cpp; sourceTree = ""; }; 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectThread.cpp; path = source/Commands/CommandObjectThread.cpp; sourceTree = ""; }; 26BC7E6910F1B85900F91463 /* Address.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Address.cpp; path = source/Core/Address.cpp; sourceTree = ""; }; 26BC7E6A10F1B85900F91463 /* AddressRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressRange.cpp; path = source/Core/AddressRange.cpp; sourceTree = ""; }; @@ -5215,8 +5212,6 @@ 26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */, 26BC7D2910F1B76300F91463 /* CommandObjectSource.h */, 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */, - 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */, - 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */, 269416AE119A024800FF2715 /* CommandObjectTarget.h */, 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */, 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */, @@ -7562,7 +7557,6 @@ 2689002313353DDE00698AC0 /* CommandObjectScript.cpp in Sources */, 2689002413353DDE00698AC0 /* CommandObjectSettings.cpp in Sources */, 2689002513353DDE00698AC0 /* CommandObjectSource.cpp in Sources */, - 2689002613353DDE00698AC0 /* CommandObjectSyntax.cpp in Sources */, 267A48011B1411E40021A5BC /* XML.cpp in Sources */, AF8AD6371BEC28C400150209 /* PlatformRemoteAppleTV.cpp in Sources */, 6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */, diff --git a/lldb/source/Commands/CMakeLists.txt b/lldb/source/Commands/CMakeLists.txt index 55b41b1..8f5fdaf 100644 --- a/lldb/source/Commands/CMakeLists.txt +++ b/lldb/source/Commands/CMakeLists.txt @@ -21,7 +21,6 @@ add_lldb_library(lldbCommands CommandObjectRegister.cpp CommandObjectSettings.cpp CommandObjectSource.cpp - CommandObjectSyntax.cpp CommandObjectTarget.cpp CommandObjectThread.cpp CommandObjectType.cpp diff --git a/lldb/source/Commands/CommandObjectSyntax.cpp b/lldb/source/Commands/CommandObjectSyntax.cpp deleted file mode 100644 index 2b83b1b..0000000 --- a/lldb/source/Commands/CommandObjectSyntax.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//===-- CommandObjectSyntax.cpp ---------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "CommandObjectSyntax.h" -#include "CommandObjectHelp.h" -#include "lldb/Interpreter/Args.h" -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Interpreter/CommandObjectMultiword.h" -#include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Interpreter/Options.h" - -using namespace lldb; -using namespace lldb_private; - -//------------------------------------------------------------------------- -// CommandObjectSyntax -//------------------------------------------------------------------------- - -CommandObjectSyntax::CommandObjectSyntax(CommandInterpreter &interpreter) - : CommandObjectParsed( - interpreter, "syntax", - "Shows the correct syntax for a given debugger command.", - "syntax ") { - CommandArgumentEntry arg; - CommandArgumentData command_arg; - - // Define the first (and only) variant of this arg. - command_arg.arg_type = eArgTypeCommandName; - command_arg.arg_repetition = eArgRepeatPlain; - - // There is only one variant this argument could be; put it into the argument - // entry. - arg.push_back(command_arg); - - // Push the data for the first argument into the m_arguments vector. - m_arguments.push_back(arg); -} - -CommandObjectSyntax::~CommandObjectSyntax() = default; - -bool CommandObjectSyntax::DoExecute(Args &command, - CommandReturnObject &result) { - CommandObject::CommandMap::iterator pos; - CommandObject *cmd_obj; - const size_t argc = command.GetArgumentCount(); - - if (argc == 0) { - result.AppendError("Must call 'syntax' with a valid command."); - result.SetStatus(eReturnStatusFailed); - return false; - } - - cmd_obj = m_interpreter.GetCommandObject(command[0].ref); - bool all_okay = llvm::all_of( - command.entries().drop_front(), [&cmd_obj](const Args::ArgEntry &e) { - if (!cmd_obj || !cmd_obj->IsMultiwordObject()) - return false; - - if (!(cmd_obj = cmd_obj->GetSubcommandObject(e.ref))) - return false; - - return true; - }); - - if (!all_okay) { - std::string cmd_string; - command.GetCommandString(cmd_string); - - StreamString error_msg_stream; - const bool generate_apropos = true; - const bool generate_type_lookup = false; - CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage( - &error_msg_stream, cmd_string, "", "", generate_apropos, - generate_type_lookup); - result.AppendErrorWithFormat("%s", error_msg_stream.GetData()); - result.SetStatus(eReturnStatusFailed); - return false; - } - - Stream &output_strm = result.GetOutputStream(); - if (cmd_obj->GetOptions() != nullptr) { - output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax().str().c_str()); - output_strm.Printf( - "(Try 'help %s' for more information on command options syntax.)\n", - cmd_obj->GetCommandName().str().c_str()); - result.SetStatus(eReturnStatusSuccessFinishNoResult); - } else { - output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax().str().c_str()); - result.SetStatus(eReturnStatusSuccessFinishNoResult); - } - - return result.Succeeded(); -} diff --git a/lldb/source/Commands/CommandObjectSyntax.h b/lldb/source/Commands/CommandObjectSyntax.h deleted file mode 100644 index b65e9b1..0000000 --- a/lldb/source/Commands/CommandObjectSyntax.h +++ /dev/null @@ -1,37 +0,0 @@ -//===-- CommandObjectSyntax.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_CommandObjectSyntax_h_ -#define liblldb_CommandObjectSyntax_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" - -namespace lldb_private { - -//------------------------------------------------------------------------- -// CommandObjectSyntax -//------------------------------------------------------------------------- - -class CommandObjectSyntax : public CommandObjectParsed { -public: - CommandObjectSyntax(CommandInterpreter &interpreter); - - ~CommandObjectSyntax() override; - -protected: - bool DoExecute(Args &command, CommandReturnObject &result) override; -}; - -} // namespace lldb_private - -#endif // liblldb_CommandObjectSyntax_h_ diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a4d3160..5b36428 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -34,7 +34,6 @@ #include "../Commands/CommandObjectRegister.h" #include "../Commands/CommandObjectSettings.h" #include "../Commands/CommandObjectSource.h" -#include "../Commands/CommandObjectSyntax.h" #include "../Commands/CommandObjectTarget.h" #include "../Commands/CommandObjectThread.h" #include "../Commands/CommandObjectType.h"