Skip to content

Commit 18a1c81

Browse files
bulbazordmedismailben
authored andcommitted
[lldb] Introduce a macro to mark methods as unsupported with no replacement
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 renames the existing `LLDB_DEPRECATED` to `LLDB_DEPRECATED_FIXME`, and adds a `LLDB_DEPRECATED` macro to cover the second scenario. Differential Revision: https://reviews.llvm.org/D153928
1 parent 7bbfd68 commit 18a1c81

File tree

9 files changed

+34
-27
lines changed

9 files changed

+34
-27
lines changed

lldb/include/lldb/API/SBCommandReturnObject.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class LLDB_API SBCommandReturnObject {
4747
const char *GetError();
4848

4949
#ifndef SWIG
50-
LLDB_DEPRECATED("Use PutOutput(SBFile) or PutOutput(FileSP)",
51-
"PutOutput(SBFile)")
50+
LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",
51+
"PutOutput(SBFile)")
5252
size_t PutOutput(FILE *fh);
5353
#endif
5454

@@ -61,8 +61,8 @@ class LLDB_API SBCommandReturnObject {
6161
size_t GetErrorSize();
6262

6363
#ifndef SWIG
64-
LLDB_DEPRECATED("Use PutError(SBFile) or PutError(FileSP)",
65-
"PutError(SBFile)")
64+
LLDB_DEPRECATED_FIXME("Use PutError(SBFile) or PutError(FileSP)",
65+
"PutError(SBFile)")
6666
size_t PutError(FILE *fh);
6767
#endif
6868

@@ -87,22 +87,22 @@ class LLDB_API SBCommandReturnObject {
8787
bool GetDescription(lldb::SBStream &description);
8888

8989
#ifndef SWIG
90-
LLDB_DEPRECATED(
90+
LLDB_DEPRECATED_FIXME(
9191
"Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
9292
"SetImmediateOutputFile(SBFile)")
9393
void SetImmediateOutputFile(FILE *fh);
9494

95-
LLDB_DEPRECATED(
95+
LLDB_DEPRECATED_FIXME(
9696
"Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
9797
"SetImmediateErrorFile(SBFile)")
9898
void SetImmediateErrorFile(FILE *fh);
9999

100-
LLDB_DEPRECATED(
100+
LLDB_DEPRECATED_FIXME(
101101
"Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
102102
"SetImmediateOutputFile(SBFile)")
103103
void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
104104

105-
LLDB_DEPRECATED(
105+
LLDB_DEPRECATED_FIXME(
106106
"Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
107107
"SetImmediateErrorFile(SBFile)")
108108
void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);

lldb/include/lldb/API/SBDebugger.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class LLDB_API SBDebugger {
113113

114114
static void Terminate();
115115

116-
LLDB_DEPRECATED("Use one of the other Create variants", "Create(bool)")
116+
LLDB_DEPRECATED_FIXME("Use one of the other Create variants", "Create(bool)")
117117
static lldb::SBDebugger Create();
118118

119119
static lldb::SBDebugger Create(bool source_init_files);
@@ -206,7 +206,7 @@ class LLDB_API SBDebugger {
206206
lldb::SBListener GetListener();
207207

208208
#ifndef SWIG
209-
LLDB_DEPRECATED(
209+
LLDB_DEPRECATED_FIXME(
210210
"Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, "
211211
"SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, "
212212
"FileSP, FileSP)",
@@ -329,8 +329,8 @@ class LLDB_API SBDebugger {
329329
void *baton);
330330

331331
#ifndef SWIG
332-
LLDB_DEPRECATED("Use DispatchInput(const void *, size_t)",
333-
"DispatchInput(const void *, size_t)")
332+
LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)",
333+
"DispatchInput(const void *, size_t)")
334334
void DispatchInput(void *baton, const void *data, size_t data_len);
335335
#endif
336336

lldb/include/lldb/API/SBDefines.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
// supports the attribute.
3535
#if defined(SWIG) or _cplusplus < 201402L
3636
#undef LLDB_DEPRECATED
37-
#define LLDB_DEPRECATED(MSG, FIX)
37+
#undef LLDB_DEPRECATED_FIXME
38+
#define LLDB_DEPRECATED(MSG)
39+
#define LLDB_DEPRECATED_FIXME(MSG, FIX)
3840
#endif
3941

4042
// Forward Declarations

lldb/include/lldb/API/SBFileSpec.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ class LLDB_API SBFileSpec {
1919

2020
SBFileSpec(const lldb::SBFileSpec &rhs);
2121

22-
LLDB_DEPRECATED("Use the other constructor to determine if this the file "
23-
"spec should be resolved",
24-
"SBFileSpec(const char *, bool)")
22+
LLDB_DEPRECATED_FIXME(
23+
"Use the other constructor to determine if this the file "
24+
"spec should be resolved",
25+
"SBFileSpec(const char *, bool)")
2526
SBFileSpec(const char *path);
2627

2728
SBFileSpec(const char *path, bool resolve);

lldb/include/lldb/API/SBProcess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class LLDB_API SBProcess {
4848

4949
const char *GetPluginName();
5050

51-
LLDB_DEPRECATED("Use GetPluginName()", "GetPluginName()")
51+
LLDB_DEPRECATED_FIXME("Use GetPluginName()", "GetPluginName()")
5252
const char *GetShortPluginName();
5353

5454
void Clear();

lldb/include/lldb/API/SBStructuredData.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ class SBStructuredData {
7272
/// Return the integer value if this data structure is an integer type.
7373
int64_t GetSignedIntegerValue(int64_t fail_value = 0) const;
7474

75-
LLDB_DEPRECATED("Specify if the value is signed or unsigned",
76-
"uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
75+
LLDB_DEPRECATED_FIXME(
76+
"Specify if the value is signed or unsigned",
77+
"uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
7778
uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
7879

7980
/// Return the floating point value if this data structure is a floating

lldb/include/lldb/API/SBTarget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ class LLDB_API SBTarget {
391391
/// \return
392392
/// An error to indicate success, fail, and any reason for
393393
/// failure.
394-
LLDB_DEPRECATED("Use SetModuleLoadAddress(lldb::SBModule, uint64_t)",
395-
"SetModuleLoadAddress(lldb::SBModule, uint64_t)")
394+
LLDB_DEPRECATED_FIXME("Use SetModuleLoadAddress(lldb::SBModule, uint64_t)",
395+
"SetModuleLoadAddress(lldb::SBModule, uint64_t)")
396396
lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
397397
int64_t sections_offset);
398398

lldb/include/lldb/API/SBValue.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class LLDB_API SBValue {
105105

106106
const char *GetLocation();
107107

108-
LLDB_DEPRECATED("Use the variant that takes an SBError &",
109-
"SetValueFromCString(const char *, SBError &)")
108+
LLDB_DEPRECATED_FIXME("Use the variant that takes an SBError &",
109+
"SetValueFromCString(const char *, SBError &)")
110110
bool SetValueFromCString(const char *value_str);
111111

112112
bool SetValueFromCString(const char *value_str, lldb::SBError &error);
@@ -124,7 +124,7 @@ class LLDB_API SBValue {
124124
lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset,
125125
lldb::SBType type);
126126

127-
LLDB_DEPRECATED("Use the expression evaluator to perform type casting", "")
127+
LLDB_DEPRECATED("Use the expression evaluator to perform type casting")
128128
lldb::SBValue Cast(lldb::SBType type);
129129

130130
lldb::SBValue CreateValueFromExpression(const char *name,
@@ -295,7 +295,7 @@ class LLDB_API SBValue {
295295

296296
lldb::SBValue Dereference();
297297

298-
LLDB_DEPRECATED("Use GetType().IsPointerType() instead", "")
298+
LLDB_DEPRECATED("Use GetType().IsPointerType() instead")
299299
bool TypeIsPointerType();
300300

301301
lldb::SBType GetType();

lldb/include/lldb/lldb-defines.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@
125125

126126
#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
127127

128+
#define LLDB_DEPRECATED(MSG) \
129+
[[deprecated("This method is no longer supported: " MSG)]]
130+
128131
#if defined(__clang__)
129-
#define LLDB_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
132+
#define LLDB_DEPRECATED_FIXME(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
130133
#else
131-
#define LLDB_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
134+
#define LLDB_DEPRECATED_FIXME(MSG, FIX) LLDB_DEPRECATED(MSG)
132135
#endif
133136

134137
#endif // LLDB_LLDB_DEFINES_H

0 commit comments

Comments
 (0)