forked from qt-creator/qt-creator
ClangCodeModel: Clean file paths resulting from "follow symbol"
Apparently, libclang can give us non-cleaned paths, which we never
noticed until ea215d612d
.
We also restore the previous behavior of TextDocument::setFilePath() in
order to prevent similar regressions elsewhere.
Fixes: QTCREATORBUG-26561
Change-Id: I218ed29600e9fb6b299aa2ba0b9d1464f475c06b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -155,7 +155,8 @@ static ::Utils::ProcessLinkCallback extendedCallback(::Utils::ProcessLinkCallbac
|
||||
// If globalFollowSymbol finds nothing follow to the declaration.
|
||||
return [original_callback = std::move(callback), result](const ::Utils::Link &link) {
|
||||
if (link.linkTextStart < 0 && result.isResultOnlyForFallBack) {
|
||||
return original_callback(::Utils::Link(::Utils::FilePath::fromString(result.fileName),
|
||||
return original_callback(Utils::Link(
|
||||
Utils::FilePath::fromString(result.fileName).cleanPath(),
|
||||
result.startLine,
|
||||
result.startColumn - 1));
|
||||
}
|
||||
@@ -242,7 +243,7 @@ void ClangFollowSymbol::findLink(const CppEditor::CursorInEditor &data,
|
||||
symbolFinder,
|
||||
inNextSplit);
|
||||
} else {
|
||||
callback(Link(Utils::FilePath::fromString(result.fileName),
|
||||
callback(Link(Utils::FilePath::fromString(result.fileName).cleanPath(),
|
||||
result.startLine,
|
||||
result.startColumn - 1));
|
||||
}
|
||||
|
@@ -651,7 +651,7 @@ void TextDocument::setFilePath(const Utils::FilePath &newName)
|
||||
{
|
||||
if (newName == filePath())
|
||||
return;
|
||||
IDocument::setFilePath(newName.absoluteFilePath());
|
||||
IDocument::setFilePath(newName.absoluteFilePath().cleanPath());
|
||||
}
|
||||
|
||||
IDocument::ReloadBehavior TextDocument::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
|
Reference in New Issue
Block a user