================
@@ -32,6 +32,42 @@ class ScriptedPythonInterface : virtual public
ScriptedInterface {
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter);
~ScriptedPythonInterface() override = default;
+ enum class AbstractMethodCheckerCases {
+ eNotImplemented,
+ eNotAllocated,
+ eNotCallable,
+ eValid
+ };
+
+ llvm::Expected<std::map<llvm::StringLiteral, AbstractMethodCheckerCases>>
+ CheckAbstractMethodImplementation(
+ const python::PythonDictionary &class_dict) const {
+
+ using namespace python;
+
+ std::map<llvm::StringLiteral, AbstractMethodCheckerCases> checker;
+#define HANDLE_ERROR(method_name, error)
\
+ {
\
+ checker[method_name] = error;
\
+ continue;
\
+ }
+
+ for (const llvm::StringLiteral &method_name : GetAbstractMethods()) {
+ if (!class_dict.HasKey(method_name))
+ HANDLE_ERROR(method_name, AbstractMethodCheckerCases::eNotImplemented)
+ auto callable_or_err = class_dict.GetItem(method_name);
+ if (!callable_or_err)
+ HANDLE_ERROR(method_name, AbstractMethodCheckerCases::eNotAllocated)
+ if (!PythonCallable::Check(callable_or_err.get().get()))
----------------
JDevlieghere wrote:
~So you never check the error? Doesn't this assert in a debug build?~ nvm you
do on line 60.
https://github.com/llvm/llvm-project/pull/71260
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits