[Lldb-commits] [PATCH] D153928: [lldb] Introduce a macro to mark methods as unsupported with no replacement

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 27 15:57:20 PDT 2023


bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, jingham, mib.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We already have LLDB_DEPRECATED which is used to mark methods as
deprecated with a message and an alternative to use instead. This is
expresses an intent of "We recognize this functionality is useful but
there are some pitfalls with the interface we have exposed."

In other cases, there are no "alternative" methods to use and the code should be
refactored to avoid using a method entirely. For example,
`SBValue::Cast` should be avoided in favor of using the expression
evaluator to perform a cast. There isn't a mechanical solution, the
recommendation is to instead refactor your code. This commit introduces a
different macro to distinguish this case from the first.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153928

Files:
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBValue.h
  lldb/include/lldb/lldb-defines.h


Index: lldb/include/lldb/lldb-defines.h
===================================================================
--- lldb/include/lldb/lldb-defines.h
+++ lldb/include/lldb/lldb-defines.h
@@ -131,4 +131,12 @@
 #define LLDB_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
 #endif
 
+#if defined(__clang__)
+#define LLDB_UNSUPPORTED(MSG)                                                  \
+  __attribute__((deprecated("This method is no longer supported: " MSG, "")))
+#else
+#define LLDB_UNSUPPORTED(MSG)                                                  \
+  [[deprecated("This method is no longer supported: " MSG)]]
+#endif
+
 #endif // LLDB_LLDB_DEFINES_H
Index: lldb/include/lldb/API/SBValue.h
===================================================================
--- lldb/include/lldb/API/SBValue.h
+++ lldb/include/lldb/API/SBValue.h
@@ -124,7 +124,7 @@
   lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset,
                                     lldb::SBType type);
 
-  LLDB_DEPRECATED("Use the expression evaluator to perform type casting", "")
+  LLDB_UNSUPPORTED("Use the expression evaluator to perform type casting")
   lldb::SBValue Cast(lldb::SBType type);
 
   lldb::SBValue CreateValueFromExpression(const char *name,
@@ -295,7 +295,7 @@
 
   lldb::SBValue Dereference();
 
-  LLDB_DEPRECATED("Use GetType().IsPointerType() instead", "")
+  LLDB_UNSUPPORTED("Use GetType().IsPointerType() instead")
   bool TypeIsPointerType();
 
   lldb::SBType GetType();
Index: lldb/include/lldb/API/SBDefines.h
===================================================================
--- lldb/include/lldb/API/SBDefines.h
+++ lldb/include/lldb/API/SBDefines.h
@@ -34,7 +34,9 @@
 // supports the attribute.
 #if defined(SWIG) || _cplusplus < 201402L
 #undef LLDB_DEPRECATED
+#undef LLDB_UNSUPPORTED
 #define LLDB_DEPRECATED(MSG, FIX)
+#define LLDB_UNSUPPORTED(MSG)
 #endif
 
 // Forward Declarations


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153928.535179.patch
Type: text/x-patch
Size: 1898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230627/811fbd47/attachment.bin>


More information about the lldb-commits mailing list