forked from qt-creator/qt-creator
CppTools: Remove assertions for CppModelManager::instance()
It cannot return null. Change-Id: I3ac5f33e7e02554edc8df067c7b85518e58c1fc2 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
a22dc36aaf
commit
831fb6181e
@@ -252,15 +252,14 @@ static Function *findDeclaration(const Class *cl, const QString &functionName)
|
||||
// TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this function
|
||||
static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
||||
{
|
||||
if (CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance()) {
|
||||
const Snapshot snapshot = cppModelManager->snapshot();
|
||||
CppTools::SymbolFinder symbolFinder;
|
||||
if (Function *fun = symbolFinder.findMatchingDefinition(functionDeclaration, snapshot)) {
|
||||
if (line)
|
||||
*line = fun->line();
|
||||
CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance();
|
||||
const Snapshot snapshot = cppModelManager->snapshot();
|
||||
CppTools::SymbolFinder symbolFinder;
|
||||
if (Function *fun = symbolFinder.findMatchingDefinition(functionDeclaration, snapshot)) {
|
||||
if (line)
|
||||
*line = fun->line();
|
||||
|
||||
return snapshot.document(QString::fromUtf8(fun->fileName(), fun->fileNameLength()));
|
||||
}
|
||||
return snapshot.document(QString::fromUtf8(fun->fileName(), fun->fileNameLength()));
|
||||
}
|
||||
|
||||
return Document::Ptr();
|
||||
|
||||
Reference in New Issue
Block a user