Files
clang-p2996/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
Pete Lawrence c82b7fddfc [lldb] Remove redundant severity substring within a diagnostic message. (#76111)
For example, the following message has the severity string "error: "
twice.
	> "error: <EXPR>:3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but
with this fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I
considered putting the removal logic in a loop, but I decided that if
something is generating more than one redundant severity substring, then
that's a problem the message's source should probably fix.

rdar://114203423
2024-01-18 12:04:26 -08:00

29 lines
1.1 KiB
Python

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
@skipIf(compiler="clang", compiler_version=["<", "11.0"])
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(
self, "// break here", lldb.SBFileSpec("main.m")
)
# Try importing our custom module. This will fail as LLDB won't define
# the CLANG_ONLY define when it compiles the module for the expression
# evaluator.
# Check that the error message shows file/line/column, prints the relevant
# line from the source code and mentions the module that failed to build.
self.expect(
"expr @import LLDBTestModule",
error=True,
substrs=[
"module.h:4:1: use of undeclared identifier 'syntax_error_for_lldb_to_find'",
"syntax_error_for_lldb_to_find // comment that tests source printing",
"could not build module 'LLDBTestModule'",
],
)