forked from qt-creator/qt-creator
C++/QmlJS: Warnings if C++ based QML type detection fails.
Change-Id: I1e206e09c4068cc541978ee148f9ed8c4138c249 Reviewed-on: http://codereview.qt.nokia.com/3579 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -1060,7 +1060,9 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
|
||||
}
|
||||
#else
|
||||
QSet<int> lines;
|
||||
foreach (const Document::DiagnosticMessage &m, doc->diagnosticMessages()) {
|
||||
QList<Document::DiagnosticMessage> messages = doc->diagnosticMessages();
|
||||
messages += extraDiagnostics(doc->fileName());
|
||||
foreach (const Document::DiagnosticMessage &m, messages) {
|
||||
if (m.fileName() != fileName)
|
||||
continue;
|
||||
else if (lines.contains(m.line()))
|
||||
@@ -1289,5 +1291,34 @@ void CppModelManager::finishedRefreshingSourceFiles(const QStringList &files)
|
||||
emit sourceFilesRefreshed(files);
|
||||
}
|
||||
|
||||
|
||||
void CppModelManager::setExtraDiagnostics(const QString &fileName, int kind,
|
||||
const QList<Document::DiagnosticMessage> &diagnostics)
|
||||
{
|
||||
{
|
||||
QMutexLocker locker(&protectExtraDiagnostics);
|
||||
m_extraDiagnostics[fileName].insert(kind, diagnostics);
|
||||
}
|
||||
Document::Ptr doc;
|
||||
{
|
||||
QMutexLocker locker(&protectSnapshot);
|
||||
doc = m_snapshot.document(fileName);
|
||||
}
|
||||
if (doc)
|
||||
emit documentUpdated(doc);
|
||||
}
|
||||
|
||||
QList<Document::DiagnosticMessage> CppModelManager::extraDiagnostics(const QString &fileName, int kind) const
|
||||
{
|
||||
QMutexLocker locker(&protectExtraDiagnostics);
|
||||
if (kind == -1) {
|
||||
QList<Document::DiagnosticMessage> messages;
|
||||
foreach (const QList<Document::DiagnosticMessage> &list, m_extraDiagnostics.value(fileName))
|
||||
messages += list;
|
||||
return messages;
|
||||
}
|
||||
return m_extraDiagnostics.value(fileName).value(kind);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define CPPMODELMANAGER_H
|
||||
|
||||
#include "cpptools_global.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include <cplusplus/ModelManagerInterface.h>
|
||||
#ifndef ICHECK_BUILD
|
||||
# include <projectexplorer/project.h>
|
||||
@@ -128,6 +129,12 @@ public:
|
||||
|
||||
virtual void findMacroUsages(const CPlusPlus::Macro ¯o);
|
||||
|
||||
virtual void setExtraDiagnostics(const QString &fileName, int key,
|
||||
const QList<CPlusPlus::Document::DiagnosticMessage> &diagnostics);
|
||||
virtual QList<CPlusPlus::Document::DiagnosticMessage> extraDiagnostics(
|
||||
const QString &fileName, int key = AllExtraDiagnostics) const;
|
||||
|
||||
|
||||
void finishedRefreshingSourceFiles(const QStringList &files);
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -226,6 +233,9 @@ private:
|
||||
|
||||
CppFindReferences *m_findReferences;
|
||||
bool m_indexerEnabled;
|
||||
|
||||
mutable QMutex protectExtraDiagnostics;
|
||||
QHash<QString, QHash<int, QList<CPlusPlus::Document::DiagnosticMessage> > > m_extraDiagnostics;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user