[lldb] DRAFT - Add Status::Detail
type to hold information from diagnostics
#80936
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress that lets
Status
instances separately store multiple messages such as errors, warnings, and/or notes. This approach can help break the anti-pattern where code that creates or modifies aStatus
object has no choice but to merge multiple messages (e.g. errors and warnings) together into one, long string to store all the information in the status object.By keeping messages separate, the codebase has more opportunities to give developers a richer and more pleasant experiences. For example, the codebase would have the ability to individually colorize the text of each error, warning, note, etc., as I've done for PR #80938.
Changes:
struct Status::Detail
type inStatus.cpp
std::vector<Status::Detail> m_status_details
inclass Status
std::vector<Status::Detail> m_status_details
inclass CommandReturnObject
DiagnosticManager.h
->lldb-private-enumerations.h
enum DiagnosticOrigin
enum DiagnosticSeverity
UserExpression::Evaluate
method:Status::Detail
forDiagnostic
in aDiagnosticManager
instance.Status &error
parameter.&error
parameter.CommandReturnObject::SetError
method:CommandReturnObject
individually colorize each "error:", "warning:", or "note:".