aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppsourceprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cppeditor/cppsourceprocessor.cpp')
-rw-r--r--src/plugins/cppeditor/cppsourceprocessor.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/cppeditor/cppsourceprocessor.cpp b/src/plugins/cppeditor/cppsourceprocessor.cpp
index 66cca58a0f7..55dc1f10e05 100644
--- a/src/plugins/cppeditor/cppsourceprocessor.cpp
+++ b/src/plugins/cppeditor/cppsourceprocessor.cpp
@@ -81,7 +81,8 @@ inline const CPlusPlus::Macro revision(const WorkingCopy &workingCopy,
const CPlusPlus::Macro &macro)
{
CPlusPlus::Macro newMacro(macro);
- newMacro.setFileRevision(workingCopy.get(macro.filePath()).second);
+ if (const auto entry = workingCopy.get(macro.filePath()))
+ newMacro.setFileRevision(entry->second);
return newMacro;
}
@@ -189,10 +190,9 @@ bool CppSourceProcessor::getFileContents(const FilePath &absoluteFilePath,
return false;
// Get from working copy
- if (m_workingCopy.contains(absoluteFilePath)) {
- const QPair<QByteArray, unsigned> entry = m_workingCopy.get(absoluteFilePath);
- *contents = entry.first;
- *revision = entry.second;
+ if (const auto entry = m_workingCopy.get(absoluteFilePath)) {
+ *contents = entry->first;
+ *revision = entry->second;
return true;
}
@@ -216,7 +216,7 @@ bool CppSourceProcessor::checkFile(const FilePath &absoluteFilePath) const
{
if (absoluteFilePath.isEmpty()
|| m_included.contains(absoluteFilePath)
- || m_workingCopy.contains(absoluteFilePath)) {
+ || m_workingCopy.get(absoluteFilePath)) {
return true;
}
@@ -281,7 +281,7 @@ FilePath CppSourceProcessor::resolveFile_helper(const FilePath &filePath,
} else {
path = FilePath::fromString(headerPathsIt->path) / fileName;
}
- if (m_workingCopy.contains(path) || checkFile(path))
+ if (m_workingCopy.get(path) || checkFile(path))
return path;
}
}
@@ -468,8 +468,8 @@ void CppSourceProcessor::sourceNeeded(int line, const FilePath &filePath, Includ
document->setUtf8Source(preprocessedCode);
document->keepSourceAndAST();
document->tokenize();
- document->check(m_workingCopy.contains(document->filePath()) ? Document::FullCheck
- : Document::FastCheck);
+ document->check(m_workingCopy.get(document->filePath()) ? Document::FullCheck
+ : Document::FastCheck);
m_documentFinished(document);