forked from qt-creator/qt-creator
CPlusPlus: Add toLink method to the Symbol
Basically move it from CppTools to CPlusPlus to be able to use it there. Change-Id: I0af80f93bdc029824397ceafdf940cb86c4382b0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -246,7 +246,7 @@ void CppEditorOutline::gotoSymbolInEditor()
|
||||
if (!symbol)
|
||||
return;
|
||||
|
||||
const Utils::Link &link = CppTools::linkToSymbol(symbol);
|
||||
const Utils::Link &link = symbol->toLink();
|
||||
if (!link.hasValidTarget())
|
||||
return;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
|
||||
}
|
||||
|
||||
tooltip = overview.prettyType(declaration->type(), qualifiedName);
|
||||
link = CppTools::linkToSymbol(declaration);
|
||||
link = declaration->toLink();
|
||||
helpMark = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ Link attemptFuncDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
||||
}
|
||||
|
||||
if (target) {
|
||||
result = CppTools::linkToSymbol(target);
|
||||
result = target->toLink();
|
||||
|
||||
unsigned startLine, startColumn, endLine, endColumn;
|
||||
document->translationUnit()->getTokenStartPosition(name->firstToken(), &startLine,
|
||||
@@ -762,7 +762,7 @@ Link FollowSymbolUnderCursor::findLink(
|
||||
|
||||
}
|
||||
|
||||
link = CppTools::linkToSymbol(def ? def : symbol);
|
||||
link = (def ? def : symbol)->toLink();
|
||||
link.linkTextStart = beginOfToken;
|
||||
link.linkTextEnd = endOfToken;
|
||||
return link;
|
||||
|
||||
@@ -230,26 +230,6 @@ const Macro *findCanonicalMacro(const QTextCursor &cursor, Document::Ptr documen
|
||||
return 0;
|
||||
}
|
||||
|
||||
Utils::Link linkToSymbol(Symbol *symbol)
|
||||
{
|
||||
if (!symbol)
|
||||
return Utils::Link();
|
||||
|
||||
const QString filename = QString::fromUtf8(symbol->fileName(),
|
||||
symbol->fileNameLength());
|
||||
|
||||
unsigned line = symbol->line();
|
||||
unsigned column = symbol->column();
|
||||
|
||||
if (column)
|
||||
--column;
|
||||
|
||||
if (symbol->isGenerated())
|
||||
column = 0;
|
||||
|
||||
return Utils::Link(filename, line, column);
|
||||
}
|
||||
|
||||
QSharedPointer<CppCodeModelSettings> codeModelSettings()
|
||||
{
|
||||
return CppTools::Internal::CppToolsPlugin::instance()->codeModelSettings();
|
||||
|
||||
@@ -58,8 +58,6 @@ bool CPPTOOLS_EXPORT isValidFirstIdentifierChar(const QChar &ch);
|
||||
bool CPPTOOLS_EXPORT isValidIdentifierChar(const QChar &ch);
|
||||
bool CPPTOOLS_EXPORT isValidIdentifier(const QString &s);
|
||||
|
||||
Utils::Link CPPTOOLS_EXPORT linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||
|
||||
QString CPPTOOLS_EXPORT identifierUnderCursor(QTextCursor *cursor);
|
||||
|
||||
bool CPPTOOLS_EXPORT isOwnershipRAIIType(CPlusPlus::Symbol *symbol,
|
||||
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
|
||||
VirtualFunctionProposalItem *itemFromFunction(Function *func) const
|
||||
{
|
||||
const Utils::Link link = CppTools::linkToSymbol(maybeDefinitionFor(func));
|
||||
const Utils::Link link = maybeDefinitionFor(func)->toLink();
|
||||
QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func));
|
||||
if (func->isPureVirtual())
|
||||
text += QLatin1String(" = 0");
|
||||
|
||||
Reference in New Issue
Block a user