ClangTools: Do not assume there is a corresponding open document

... when creating a TextMark.
Amends 2ad12b5b2c.

Change-Id: Ic748012dadda0fc94814176589a3bdff20cb4cd6
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2024-06-13 12:57:55 +02:00
parent 1eb2535c62
commit d7ed05ae14

View File

@@ -20,10 +20,13 @@ using namespace Utils;
namespace ClangTools {
namespace Internal {
static TextMarkCategory clangToolsCategory()
{
return {Tr::tr("Clang Tools"), Id(Constants::DIAGNOSTIC_MARK_ID)};
}
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *document)
: TextMark(document,
diagnostic.location.line,
{Tr::tr("Clang Tools"), Id(Constants::DIAGNOSTIC_MARK_ID)})
: TextMark(document, diagnostic.location.line, clangToolsCategory())
, m_diagnostic(diagnostic)
{
setSettingsPage(Constants::SETTINGS_PAGE_ID);
@@ -60,7 +63,8 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *docum
}
DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
: DiagnosticMark(diagnostic, TextDocument::textDocumentForFilePath(diagnostic.location.filePath))
: TextMark(diagnostic.location.filePath, diagnostic.location.line, clangToolsCategory())
, m_diagnostic(diagnostic)
{}
void DiagnosticMark::disable()