kastiglione created this revision. kastiglione added reviewers: jingham, aprantl. kastiglione added a project: LLDB. Herald added a subscriber: JDevlieghere. Herald added a project: All. kastiglione requested review of this revision. Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Returning `None` from a Python type summary results in a summary string of "None". To indicate no summary string, the implementation should return the empty string. This change fixes a bug where the summary provider for `llvm::Optional` would incorrectly show `None`. This would happen when the underlying type itself had no summary provider. Now, when the underlying type has a summary string, that string is used, but when there is no summary, then the `Optional` will also have no summary (`return ''`). Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D122041 Files: llvm/utils/lldbDataFormatters.py Index: llvm/utils/lldbDataFormatters.py =================================================================== --- llvm/utils/lldbDataFormatters.py +++ llvm/utils/lldbDataFormatters.py @@ -137,7 +137,11 @@ def OptionalSummaryProvider(valobj, internal_dict): val = GetOptionalValue(valobj) - return val.summary if val else 'None' + if val is None: + return 'None' + if val.summary: + return val.summary + return '' class OptionalSynthProvider: """Provides deref support to llvm::Optional<T>"""
Index: llvm/utils/lldbDataFormatters.py =================================================================== --- llvm/utils/lldbDataFormatters.py +++ llvm/utils/lldbDataFormatters.py @@ -137,7 +137,11 @@ def OptionalSummaryProvider(valobj, internal_dict): val = GetOptionalValue(valobj) - return val.summary if val else 'None' + if val is None: + return 'None' + if val.summary: + return val.summary + return '' class OptionalSynthProvider: """Provides deref support to llvm::Optional<T>"""
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits