llvm-c166/lldb/source/API/SBCommandReturnObjectImpl.h
Med Ismail Bennani c35bdc99a3
[lldb/script] Migrate ParsedCommand & raw commands onto ScriptedPythonInterface (#210430)
Give both `command script add -c` (raw class) and `-p` (ParsedCommand) a
single, shared
`ScriptedCommandInterface`/`ScriptedCommandPythonInterface`, built on
the existing `ScriptedPythonInterface` machinery: `CreatePluginObject`
delegates to the base template, and every other method goes through
`Dispatch`.

Add a lighter `ScriptedCommand` ABC template (`scripted_command.py`) for
raw mode; the existing `ParsedCommand`/`LLDBOptionValueParser` classes
are kept as-is.

Extend `ScriptedPythonInterface` with a few `Transform` overloads
(`DebuggerSP`, `std::vector<std::string>`, `CommandReturnObject &`) so
those argument types route through `Dispatch` without extra plumbing.

Delete the standalone SWIG bridge functions this plugin was the sole
caller of. `CommandObjectScriptingObjectRaw` and
`CommandObjectScriptingObjectParsed` now hold a
`ScriptedCommandInterfaceSP` instead of a raw
`StructuredData::GenericSP`; `command script add`'s `DoExecute`
constructs the interface once via
`CreateScriptedCommandInterface()->CreatePluginObject` for either flag.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-07-28 17:09:59 -07:00

31 lines
1 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SOURCE_API_SBCOMMANDRETURNOBJECTIMPL_H
#define LLDB_SOURCE_API_SBCOMMANDRETURNOBJECTIMPL_H
namespace lldb_private {
class CommandReturnObject;
class SBCommandReturnObjectImpl {
public:
SBCommandReturnObjectImpl();
SBCommandReturnObjectImpl(CommandReturnObject &ref);
SBCommandReturnObjectImpl(const SBCommandReturnObjectImpl &rhs);
SBCommandReturnObjectImpl &operator=(const SBCommandReturnObjectImpl &rhs);
~SBCommandReturnObjectImpl();
CommandReturnObject *get() const { return m_ptr; }
private:
CommandReturnObject *m_ptr;
bool m_owned = true;
};
} // namespace lldb_private
#endif // LLDB_SOURCE_API_SBCOMMANDRETURNOBJECTIMPL_H