Merge remote-tracking branch 'origin/3.5'

Change-Id: Ife5fdcd71b0adc99d4297a28a64515e9e93d7864
This commit is contained in:
Eike Ziller
2015-09-04 09:19:28 +02:00
45 changed files with 10790 additions and 9940 deletions

View File

@@ -75,7 +75,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
TextEditor::TextDocument *document)
: BaseEditorDocumentProcessor(document)
, m_modelManagerSupport(modelManagerSupport)
, m_parser(document->filePath().toString())
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
, m_parserRevision(0)
, m_semanticHighlighter(document)
, m_builtinProcessor(document, /*enableSemanticHighlighter=*/ false)
@@ -95,7 +95,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
const int firstLine = 1;
const int lastLine = baseTextDocument()->document()->blockCount();
CreateMarkers *createMarkers = CreateMarkers::create(m_parser.semanticMarker(),
CreateMarkers *createMarkers = CreateMarkers::create(m_parser->semanticMarker(),
baseTextDocument()->filePath().toString(),
firstLine, lastLine);
return createMarkers->start();
@@ -152,9 +152,9 @@ CppTools::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo()
return m_builtinProcessor.recalculateSemanticInfo();
}
CppTools::BaseEditorDocumentParser *ClangEditorDocumentProcessor::parser()
CppTools::BaseEditorDocumentParser::Ptr ClangEditorDocumentProcessor::parser()
{
return &m_parser;
return m_parser;
}
CPlusPlus::Snapshot ClangEditorDocumentProcessor::snapshot()
@@ -188,7 +188,7 @@ ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &f
void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor()
{
const CppTools::ProjectPart::Ptr projectPart = m_parser.projectPart();
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPart();
QTC_ASSERT(projectPart, return);
updateTranslationUnitForEditor(*projectPart.data());
@@ -203,7 +203,7 @@ void ClangEditorDocumentProcessor::onParserFinished()
return;
// Emit ifdefed out blocks
const auto ifdefoutBlocks = toTextEditorBlocks(m_parser.ifdefedOutBlocks());
const auto ifdefoutBlocks = toTextEditorBlocks(m_parser->ifdefedOutBlocks());
emit ifdefedOutBlocksUpdated(revision(), ifdefoutBlocks);
// Run semantic highlighter

View File

@@ -66,7 +66,7 @@ public:
void semanticRehighlight() override;
void recalculateSemanticInfoDetached(bool force) override;
CppTools::SemanticInfo recalculateSemanticInfo() override;
CppTools::BaseEditorDocumentParser *parser() override;
CppTools::BaseEditorDocumentParser::Ptr parser() override;
CPlusPlus::Snapshot snapshot() override;
bool isParserRunning() const override;
@@ -94,7 +94,7 @@ private:
private:
QPointer<ModelManagerSupportClang> m_modelManagerSupport;
std::vector<ClangTextMark> m_clangTextMarks;
ClangEditorDocumentParser m_parser;
QSharedPointer<ClangEditorDocumentParser> m_parser;
CppTools::ProjectPart::Ptr m_projectPart;
QFutureWatcher<void> m_parserWatcher;
unsigned m_parserRevision;

View File

@@ -249,7 +249,7 @@ QStringList createPCHInclusionOptions(const QString &pchFile)
ProjectPart::Ptr projectPartForFile(const QString &filePath)
{
if (CppTools::BaseEditorDocumentParser *parser = CppTools::BaseEditorDocumentParser::get(filePath))
if (const auto parser = CppTools::BaseEditorDocumentParser::get(filePath))
return parser->projectPart();
return ProjectPart::Ptr();
}

View File

@@ -786,7 +786,7 @@ public:
if (totalTime.elapsed() > 10000)
return false;
if (writeFileAgainTime.elapsed() > 1000) {
if (writeFileAgainTime.elapsed() > 3000) {
// The timestamp did not change, try again now.
QTC_ASSERT(writeFile(m_filePath, m_fileContents), return false);
writeFileAgainTime.restart();