Author: Ebuka Ezike
Date: 2026-03-05T15:05:51Z
New Revision: 02e9b08d0286a2aac18dadd9bfff34ba9d7bf869

URL: 
https://github.com/llvm/llvm-project/commit/02e9b08d0286a2aac18dadd9bfff34ba9d7bf869
DIFF: 
https://github.com/llvm/llvm-project/commit/02e9b08d0286a2aac18dadd9bfff34ba9d7bf869.diff

LOG: [lldb] Use UnimplementedError for GetSDKFromDebugInfo (#184199)

We can now differentiate unimplemented errors from actual errors that
may be useful to users.

Added: 
    

Modified: 
    lldb/include/lldb/Target/Platform.h
    lldb/include/lldb/Utility/UnimplementedError.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index 637d4c37b90bc..fe9d4f7982bbf 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -27,6 +27,7 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/Timeout.h"
+#include "lldb/Utility/UnimplementedError.h"
 #include "lldb/Utility/UserIDResolver.h"
 #include "lldb/Utility/XcodeSDK.h"
 #include "lldb/lldb-private-forward.h"
@@ -453,7 +454,7 @@ class Platform : public PluginInterface {
   ///          (e.g., a public and internal SDK).
   virtual llvm::Expected<std::pair<XcodeSDK, bool>>
   GetSDKPathFromDebugInfo(Module &module) {
-    return llvm::createStringError(
+    return llvm::make_error<UnimplementedError>(
         llvm::formatv("{0} not implemented for '{1}' platform.",
                       LLVM_PRETTY_FUNCTION, GetName()));
   }
@@ -469,7 +470,7 @@ class Platform : public PluginInterface {
   ///          Xcode SDK.
   virtual llvm::Expected<std::string>
   ResolveSDKPathFromDebugInfo(Module &module) {
-    return llvm::createStringError(
+    return llvm::make_error<UnimplementedError>(
         llvm::formatv("{0} not implemented for '{1}' platform.",
                       LLVM_PRETTY_FUNCTION, GetName()));
   }
@@ -478,9 +479,10 @@ class Platform : public PluginInterface {
   ///
   /// \param[in] unit The CU
   ///
-  /// \returns A parsed XcodeSDK object if successful, an Error otherwise. 
-  virtual llvm::Expected<XcodeSDK> GetSDKPathFromDebugInfo(CompileUnit &unit) {
-    return llvm::createStringError(
+  /// \returns A parsed XcodeSDK object if successful, an Error otherwise.
+  virtual llvm::Expected<XcodeSDK>
+  GetSDKPathFromDebugInfo(CompileUnit & /*unit*/) {
+    return llvm::make_error<UnimplementedError>(
         llvm::formatv("{0} not implemented for '{1}' platform.",
                       LLVM_PRETTY_FUNCTION, GetName()));
   }
@@ -495,7 +497,7 @@ class Platform : public PluginInterface {
   ///          Xcode SDK.
   virtual llvm::Expected<std::string>
   ResolveSDKPathFromDebugInfo(CompileUnit &unit) {
-    return llvm::createStringError(
+    return llvm::make_error<UnimplementedError>(
         llvm::formatv("{0} not implemented for '{1}' platform.",
                       LLVM_PRETTY_FUNCTION, GetName()));
   }

diff  --git a/lldb/include/lldb/Utility/UnimplementedError.h 
b/lldb/include/lldb/Utility/UnimplementedError.h
index c6fab0a9483c0..989c4ecc0084e 100644
--- a/lldb/include/lldb/Utility/UnimplementedError.h
+++ b/lldb/include/lldb/Utility/UnimplementedError.h
@@ -14,10 +14,21 @@
 
 namespace lldb_private {
 class UnimplementedError : public llvm::ErrorInfo<UnimplementedError> {
+  std::string m_message;
+
 public:
   static char ID;
 
-  void log(llvm::raw_ostream &OS) const override { OS << "Not implemented"; }
+  UnimplementedError() = default;
+  explicit UnimplementedError(std::string message)
+      : m_message(std::move(message)) {}
+
+  void log(llvm::raw_ostream &OS) const override {
+    if (!m_message.empty())
+      OS << m_message;
+    else
+      OS << "Not implemented";
+  }
 
   std::error_code convertToErrorCode() const override {
     return llvm::errc::not_supported;


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to