[Lldb-commits] [lldb] [lldb] Fix a crash when two diagnostics are on the same column or in … (PR #112451)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 16 09:15:40 PDT 2024
================
@@ -16,12 +16,36 @@ std::string Render(std::vector<DiagnosticDetail> details) {
} // namespace
TEST_F(ErrorDisplayTest, RenderStatus) {
- DiagnosticDetail::SourceLocation inline_loc;
- inline_loc.in_user_input = true;
{
+ DiagnosticDetail::SourceLocation inline_loc;
+ inline_loc.in_user_input = true;
std::string result =
Render({DiagnosticDetail{inline_loc, eSeverityError, "foo", ""}});
ASSERT_TRUE(StringRef(result).contains("error:"));
ASSERT_TRUE(StringRef(result).contains("foo"));
}
+
+ {
+ DiagnosticDetail::SourceLocation loc1 = {FileSpec{"a.c"}, 13, 11, 0,
+ false, true};
+ DiagnosticDetail::SourceLocation loc2 = {FileSpec{"a.c"}, 13, 13, 0,
+ false, true};
+ std::string result =
+ Render({DiagnosticDetail{loc1, eSeverityError, "1", "1"},
+ DiagnosticDetail{loc1, eSeverityError, "2", "3"},
+ DiagnosticDetail{loc2, eSeverityError, "3", "3"}});
+ ASSERT_TRUE(StringRef(result).contains("error: 1"));
+ ASSERT_TRUE(StringRef(result).contains("error: 3"));
+ ASSERT_TRUE(StringRef(result).contains("error: 2"));
----------------
adrian-prantl wrote:
This first test is the "don't crash" test. I'll add comments.
https://github.com/llvm/llvm-project/pull/112451
More information about the lldb-commits
mailing list