================ @@ -1534,6 +1536,103 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) { return Report(SourceLocation(), DiagID); } +//===----------------------------------------------------------------------===// +// RuntimeTrapDiagnosticBuilder and helper classes +//===----------------------------------------------------------------------===// + +/// Helper class for \class RuntimeTrapDiagnosticBuilder. This class stores the +/// "trap reason" built by \class RuntimeTrapDiagnosticBuilder. This consists of +/// a trap message and trap category. +/// +/// It is intended that this object be allocated on the stack. +class TrapReason { +public: + TrapReason() {} + /// \return The trap message. Note the lifetime of the underlying storage for + /// the returned StringRef lives in this class which means the returned + /// StringRef should not be used after this class is destroyed. + StringRef getMessage() const { return Message; } + + /// \return the trap category (e.g. "Undefined Behavior Sanitizer") + StringRef getCategory() const { return Category; } + + bool isEmpty() const { return Message.size() == 0 && Category.size() == 0; } ---------------- Sirraide wrote:
Maybe this is pre-existing logic that you’ve just factored out, but if not it seems a bit weird to me that either of these would ever be empty when the other isn’t (or at least that the message would be empty but not the category). In other words, I think we should just check if `Message` is empty. https://github.com/llvm/llvm-project/pull/154618 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits