forked from qt-creator/qt-creator
		
	CppTools: Fix include hierarchy for clang code model
This makes the editor document snapshot accessible through BaseEditorDocumentProcessor since we need it for the include hierarchy if the the clang code model is activated. Task-number: QTCREATORBUG-13553 Change-Id: I7214cc578d05fe5cad6e12b4d29fe6f840a88e8d Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
		@@ -59,6 +59,7 @@ public:
 | 
			
		||||
    virtual void run() = 0;
 | 
			
		||||
    virtual void semanticRehighlight(bool force) = 0;
 | 
			
		||||
    virtual CppTools::SemanticInfo recalculateSemanticInfo() = 0;
 | 
			
		||||
    virtual CPlusPlus::Snapshot snapshot() = 0;
 | 
			
		||||
    virtual BaseEditorDocumentParser *parser() = 0;
 | 
			
		||||
    virtual bool isParserRunning() const = 0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -174,6 +174,11 @@ BaseEditorDocumentParser *BuiltinEditorDocumentProcessor::parser()
 | 
			
		||||
    return &m_parser;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CPlusPlus::Snapshot BuiltinEditorDocumentProcessor::snapshot()
 | 
			
		||||
{
 | 
			
		||||
    return m_parser.snapshot();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BuiltinEditorDocumentProcessor::semanticRehighlight(bool force)
 | 
			
		||||
{
 | 
			
		||||
    const auto source = createSemanticInfoSource(force);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,6 @@
 | 
			
		||||
#include "cpptools_global.h"
 | 
			
		||||
#include "semantichighlighter.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
class CPPTOOLS_EXPORT BuiltinEditorDocumentProcessor : public BaseEditorDocumentProcessor
 | 
			
		||||
@@ -55,6 +54,7 @@ public:
 | 
			
		||||
    void semanticRehighlight(bool force) Q_DECL_OVERRIDE;
 | 
			
		||||
    CppTools::SemanticInfo recalculateSemanticInfo() Q_DECL_OVERRIDE;
 | 
			
		||||
    BaseEditorDocumentParser *parser() Q_DECL_OVERRIDE;
 | 
			
		||||
    CPlusPlus::Snapshot snapshot() Q_DECL_OVERRIDE;
 | 
			
		||||
    bool isParserRunning() const Q_DECL_OVERRIDE;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
 | 
			
		||||
#include "cpptoolsplugin.h"
 | 
			
		||||
 | 
			
		||||
#include "builtineditordocumentparser.h"
 | 
			
		||||
#include "baseeditordocumentprocessor.h"
 | 
			
		||||
#include "cppmodelmanager.h"
 | 
			
		||||
#include "cppsourceprocessertesthelper.h"
 | 
			
		||||
#include "cppsourceprocessor.h"
 | 
			
		||||
@@ -143,9 +143,9 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
 | 
			
		||||
 | 
			
		||||
    // Check editor snapshot
 | 
			
		||||
    const QString filePath = editor->document()->filePath();
 | 
			
		||||
    auto *parser = BuiltinEditorDocumentParser::get(filePath);
 | 
			
		||||
    QVERIFY(parser);
 | 
			
		||||
    Snapshot snapshot = parser->snapshot();
 | 
			
		||||
    auto *processor = BaseEditorDocumentProcessor::get(filePath);
 | 
			
		||||
    QVERIFY(processor);
 | 
			
		||||
    Snapshot snapshot = processor->snapshot();
 | 
			
		||||
    QCOMPARE(snapshot.size(), 3); // Configuration file included
 | 
			
		||||
 | 
			
		||||
    // Check includes
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user