Commit 3d33886e authored by Erik Verbruggen's avatar Erik Verbruggen

C++: fix include/framework path handling.

Instead of having two lists of paths, now only one list is used where
both include paths and framework paths can be mixed. This reflects the
way the compiler is invoked, and retains the (correct) search order.

Task-number: QTCREATORBUG-11599
Change-Id: I373953e3e305df5b7a0d10920e12d146584adf9f
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 76152088
......@@ -427,7 +427,10 @@ void AutotoolsProject::updateCppCodeModel()
foreach (const QString &file, m_files)
part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource);
part->includePaths += m_makefileParserThread->includePaths();
foreach (const QString &inc, m_makefileParserThread->includePaths()) {
part->headerPaths += CppTools::ProjectPart::HeaderPath(
inc, CppTools::ProjectPart::HeaderPath::IncludePath);
}
part->projectDefines += m_makefileParserThread->defines();
pinfo.appendProjectPart(part);
......
......@@ -213,7 +213,8 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
QList<ProjectPart::Ptr> parts = modelManager->projectPart(fileName);
if (parts.isEmpty())
parts += modelManager->fallbackProjectPart();
QStringList includePaths, frameworkPaths, options;
ProjectPart::HeaderPaths headerPaths;
QStringList options;
PchInfo::Ptr pchInfo;
foreach (ProjectPart::Ptr part, parts) {
if (part.isNull())
......@@ -222,15 +223,14 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
pchInfo = PchManager::instance()->pchInfo(part);
if (!pchInfo.isNull())
options.append(ClangCodeModel::Utils::createPCHInclusionOptions(pchInfo->fileName()));
includePaths = part->includePaths;
frameworkPaths = part->frameworkPaths;
headerPaths = part->headerPaths;
break;
}
return new ClangCodeModel::ClangCompletionAssistInterface(
m_clangCompletionWrapper,
document, position, fileName, reason,
options, includePaths, frameworkPaths, pchInfo);
options, headerPaths, pchInfo);
}
// ------------------------
......@@ -550,14 +550,12 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P
const QString &fileName,
AssistReason reason,
const QStringList &options,
const QStringList &includePaths,
const QStringList &frameworkPaths,
const QList<CppTools::ProjectPart::HeaderPath> &headerPaths,
const PchInfo::Ptr &pchInfo)
: DefaultAssistInterface(document, position, fileName, reason)
, m_clangWrapper(clangWrapper)
, m_options(options)
, m_includePaths(includePaths)
, m_frameworkPaths(frameworkPaths)
, m_headerPaths(headerPaths)
, m_savedPchPointer(pchInfo)
{
Q_ASSERT(!clangWrapper.isNull());
......@@ -1138,29 +1136,22 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
}
// Make completion for all relevant includes
QStringList includePaths = m_interface->includePaths();
const QString &currentFilePath = QFileInfo(m_interface->fileName()).path();
if (!includePaths.contains(currentFilePath))
includePaths.append(currentFilePath);
ProjectPart::HeaderPaths headerPaths = m_interface->headerPaths();
const ProjectPart::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
ProjectPart::HeaderPath::IncludePath);
if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath);
const Core::MimeType mimeType = Core::MimeDatabase::findByType(QLatin1String("text/x-c++hdr"));
const QStringList suffixes = mimeType.suffixes();
foreach (const QString &includePath, includePaths) {
QString realPath = includePath;
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
QString realPath = headerPath.path;
if (!directoryPrefix.isEmpty()) {
realPath += QLatin1Char('/');
realPath += directoryPrefix;
}
completeIncludePath(realPath, suffixes);
}
foreach (const QString &frameworkPath, m_interface->frameworkPaths()) {
QString realPath = frameworkPath;
if (!directoryPrefix.isEmpty()) {
realPath += QLatin1Char('/');
realPath += directoryPrefix;
realPath += QLatin1String(".framework/Headers");
if (headerPath.isFrameworkPath())
realPath += QLatin1String(".framework/Headers");
}
completeIncludePath(realPath, suffixes);
}
......
......@@ -35,6 +35,7 @@
#include <cplusplus/Icons.h>
#include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <texteditor/codeassist/basicproposalitem.h>
#include <texteditor/codeassist/completionassistprovider.h>
......@@ -76,8 +77,7 @@ public:
const QString &fileName,
TextEditor::AssistReason reason,
const QStringList &options,
const QStringList &includePaths,
const QStringList &frameworkPaths,
const QList<CppTools::ProjectPart::HeaderPath> &headerPaths,
const Internal::PchInfo::Ptr &pchInfo);
ClangCodeModel::ClangCompleter::Ptr clangWrapper() const
......@@ -91,16 +91,14 @@ public:
const QStringList &options() const
{ return m_options; }
const QStringList &includePaths() const
{ return m_includePaths; }
const QStringList &frameworkPaths() const
{ return m_frameworkPaths; }
const QList<CppTools::ProjectPart::HeaderPath> &headerPaths() const
{ return m_headerPaths; }
private:
ClangCodeModel::ClangCompleter::Ptr m_clangWrapper;
ClangCodeModel::Internal::UnsavedFiles m_unsavedFiles;
QStringList m_options, m_includePaths, m_frameworkPaths;
QStringList m_options;
QList<CppTools::ProjectPart::HeaderPath> m_headerPaths;
Internal::PchInfo::Ptr m_savedPchPointer;
};
......
......@@ -209,11 +209,20 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind
result << buildDefines(pPart->toolchainDefines, false);
result << buildDefines(pPart->projectDefines, false);
foreach (const QString &frameworkPath, pPart->frameworkPaths)
result.append(QLatin1String("-F") + frameworkPath);
foreach (const QString &inc, pPart->includePaths)
if (!inc.isEmpty() && !isBlacklisted(inc))
result << (QLatin1String("-I") + inc);
typedef ProjectPart::HeaderPath HeaderPath;
foreach (const HeaderPath &headerPath , pPart->headerPaths) {
if (headerPath.path.isEmpty() || isBlacklisted(headerPath.path))
continue;
QString prefix;
switch (headerPath.type) {
case HeaderPath::IncludePath: prefix = QLatin1String("-I"); break;
case HeaderPath::FrameworkPath: prefix = QLatin1String("-F"); break;
default: Q_UNREACHABLE(); break;
}
result.append(prefix + headerPath.path);
}
#if 0
qDebug() << "--- m_args:";
......
......@@ -249,7 +249,8 @@ void PchManager::doPchInfoUpdateNone(QFutureInterface<void> &future,
void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
QHash<QString, QSet<QString> > includes, frameworks;
typedef ProjectPart::HeaderPath HeaderPath;
QHash<QString, QSet<HeaderPath>> headers;
QHash<QString, QSet<QByteArray> > definesPerPCH;
QHash<QString, bool> objc;
QHash<QString, bool> cplusplus;
......@@ -266,8 +267,7 @@ void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
continue;
inputToParts[pch].append(projectPart);
includes[pch].unite(QSet<QString>::fromList(projectPart->includePaths));
frameworks[pch].unite(QSet<QString>::fromList(projectPart->frameworkPaths));
headers[pch].unite(QSet<HeaderPath>::fromList(projectPart->headerPaths));
cVersions[pch] = std::max(cVersions.value(pch, ProjectPart::C89), projectPart->cVersion);
cxxVersions[pch] = std::max(cxxVersions.value(pch, ProjectPart::CXX98), projectPart->cxxVersion);
cxxExtensionsMap[pch] = cxxExtensionsMap[pch] | projectPart->cxxExtensions;
......@@ -306,8 +306,7 @@ void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
projectPart->cVersion = cVersions[pch];
projectPart->cxxVersion = cxxVersions[pch];
projectPart->cxxExtensions = cxxExtensionsMap[pch];
projectPart->includePaths = includes[pch].toList();
projectPart->frameworkPaths = frameworks[pch].toList();
projectPart->headerPaths = headers[pch].toList();
QList<QByteArray> defines = definesPerPCH[pch].toList();
if (!defines.isEmpty()) {
......@@ -378,22 +377,20 @@ void PchManager::doPchInfoUpdateCustom(QFutureInterface<void> &future,
future.setProgressRange(0, 1);
future.setProgressValue(0);
QSet<QString> includes, frameworks;
ProjectPart::HeaderPaths headers;
bool objc = false;
bool cplusplus = false;
ProjectPart::Ptr united(new ProjectPart());
united->cxxVersion = ProjectPart::CXX98;
foreach (const ProjectPart::Ptr &projectPart, params.projectParts) {
includes.unite(QSet<QString>::fromList(projectPart->includePaths));
frameworks.unite(QSet<QString>::fromList(projectPart->frameworkPaths));
headers += projectPart->headerPaths;
united->cVersion = std::max(united->cVersion, projectPart->cVersion);
united->cxxVersion = std::max(united->cxxVersion, projectPart->cxxVersion);
united->qtVersion = std::max(united->qtVersion, projectPart->qtVersion);
objc |= hasObjCFiles(projectPart);
cplusplus |= hasCppFiles(projectPart);
}
united->frameworkPaths = frameworks.toList();
united->includePaths = includes.toList();
united->headerPaths = headers;
QStringList opts = Utils::createClangOptions(
united, getPrefixFileKind(objc, cplusplus));
united.clear();
......
......@@ -338,27 +338,32 @@ bool CMakeProject::parseCMakeLists()
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
pinfo.clearProjectParts();
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
typedef CppTools::ProjectPart ProjectPart;
ProjectPart::Ptr part(new ProjectPart);
part->project = this;
part->displayName = displayName();
part->projectFile = projectFilePath().toString();
// This explicitly adds -I. to the include paths
part->includePaths += projectDirectory().toString();
part->headerPaths += ProjectPart::HeaderPath(projectDirectory().toString(),
ProjectPart::HeaderPath::IncludePath);
foreach (const QString &includeFile, cbpparser.includeFiles()) {
ProjectPart::HeaderPath hp(includeFile, ProjectPart::HeaderPath::IncludePath);
// CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
// paths. The work-around is to check if the include path ends in ".framework", and
// if so, add the parent directory as framework path.
if (includeFile.endsWith(QLatin1String(".framework"))) {
const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
if (slashIdx != -1) {
part->frameworkPaths += includeFile.left(slashIdx);
hp = ProjectPart::HeaderPath(includeFile.left(slashIdx),
ProjectPart::HeaderPath::FrameworkPath);
continue;
}
}
part->includePaths += includeFile;
part->headerPaths += hp;
}
part->projectDefines += cbpparser.defines();
......
......@@ -1446,7 +1446,7 @@ void CppCodeModelInspectorDialog::refresh()
}
// Merged entities
dumper.dumpMergedEntities(cmmi->includePaths(), cmmi->frameworkPaths(), cmmi->definedMacros());
dumper.dumpMergedEntities(cmmi->headerPaths(), cmmi->definedMacros());
}
enum DocumentTabs {
......@@ -1559,8 +1559,7 @@ enum ProjectPartTabs {
ProjectPartGeneralTab,
ProjectPartFilesTab,
ProjectPartDefinesTab,
ProjectPartIncludePathsTab,
ProjectPartFrameworkPathsTab,
ProjectPartHeaderPathsTab,
ProjectPartPrecompiledHeadersTab
};
......@@ -1570,8 +1569,7 @@ static QString partTabName(int tabIndex, int numberOfEntries = -1)
"&General",
"Project &Files",
"&Defines",
"&Include Paths",
"F&ramework Paths",
"&Header Paths",
"Pre&compiled Headers"
};
QString result = QLatin1String(names[tabIndex]);
......@@ -1591,13 +1589,9 @@ void CppCodeModelInspectorDialog::clearProjectPartData()
m_ui->partProjectDefinesEdit->setPlainText(QString());
m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab));
m_ui->partIncludePathsEdit->setPlainText(QString());
m_ui->projectPartTab->setTabText(ProjectPartIncludePathsTab,
partTabName(ProjectPartIncludePathsTab));
m_ui->partFrameworkPathsEdit->setPlainText(QString());
m_ui->projectPartTab->setTabText(ProjectPartFrameworkPathsTab,
partTabName(ProjectPartFrameworkPathsTab));
m_ui->partHeaderPathsEdit->setPlainText(QString());
m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab,
partTabName(ProjectPartHeaderPathsTab));
m_ui->partPrecompiledHeadersEdit->setPlainText(QString());
m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
......@@ -1654,15 +1648,10 @@ void CppCodeModelInspectorDialog::updateProjectPartData(const ProjectPart::Ptr &
m_ui->projectPartTab->setTabText(ProjectPartDefinesTab,
partTabName(ProjectPartDefinesTab, numberOfDefines));
// Include Paths
m_ui->partIncludePathsEdit->setPlainText(CMI::Utils::pathListToString(part->includePaths));
m_ui->projectPartTab->setTabText(ProjectPartIncludePathsTab,
partTabName(ProjectPartIncludePathsTab, part->includePaths.size()));
// Framework Paths
m_ui->partFrameworkPathsEdit->setPlainText(CMI::Utils::pathListToString(part->frameworkPaths));
m_ui->projectPartTab->setTabText(ProjectPartFrameworkPathsTab,
partTabName(ProjectPartFrameworkPathsTab, part->frameworkPaths.size()));
// Header Paths
m_ui->partHeaderPathsEdit->setPlainText(CMI::Utils::pathListToString(part->headerPaths));
m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab,
partTabName(ProjectPartHeaderPathsTab, part->headerPaths.size()));
// Precompiled Headers
m_ui->partPrecompiledHeadersEdit->setPlainText(
......
......@@ -261,25 +261,11 @@
</widget>
<widget class="QWidget" name="tab_15">
<attribute name="title">
<string notr="true">&amp;Include Paths</string>
<string notr="true">&amp;Header Paths</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QPlainTextEdit" name="partIncludePathsEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="definesTab_2">
<attribute name="title">
<string notr="true">F&amp;ramework Paths</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<widget class="QPlainTextEdit" name="partFrameworkPathsEdit">
<widget class="QPlainTextEdit" name="partHeaderPathsEdit">
<property name="readOnly">
<bool>true</bool>
</property>
......
......@@ -123,11 +123,11 @@ static QString &removeTrailingWhitespace(QString &input)
/// Exactly one TestFile must contain the cursor position marker '@' in the originalSource.
QuickFixTestCase::QuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &theTestFiles,
CppQuickFixFactory *factory,
const QStringList &includePaths,
const ProjectPart::HeaderPaths &headerPaths,
int resultIndex)
: m_testFiles(theTestFiles)
, m_cppCodeStylePreferences(0)
, m_restoreIncludePaths(false)
, m_restoreHeaderPaths(false)
{
QVERIFY(succeededSoFar());
......@@ -144,10 +144,10 @@ QuickFixTestCase::QuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &theTe
testFile->writeToDisk();
// Set appropriate include paths
if (!includePaths.isEmpty()) {
m_restoreIncludePaths = true;
m_includePathsToRestore = m_modelManager->includePaths();
m_modelManager->setIncludePaths(includePaths);
if (!headerPaths.isEmpty()) {
m_restoreHeaderPaths = true;
m_headerPathsToRestore = m_modelManager->headerPaths();
m_modelManager->setHeaderPaths(headerPaths);
}
// Update Code Model
......@@ -213,14 +213,22 @@ QuickFixTestCase::~QuickFixTestCase()
m_cppCodeStylePreferences->setCurrentDelegate(m_cppCodeStylePreferencesOriginalDelegateId);
// Restore include paths
if (m_restoreIncludePaths)
m_modelManager->setIncludePaths(m_includePathsToRestore);
if (m_restoreHeaderPaths)
m_modelManager->setHeaderPaths(m_headerPathsToRestore);
// Remove created files from file system
foreach (const QuickFixTestDocument::Ptr &testDocument, m_testFiles)
QVERIFY(QFile::remove(testDocument->filePath()));
}
void QuickFixTestCase::run(const QList<QuickFixTestDocument::Ptr> &theTestFiles,
CppQuickFixFactory *factory, const QString &incPath)
{
ProjectPart::HeaderPaths hps;
hps += ProjectPart::HeaderPath(incPath, ProjectPart::HeaderPath::IncludePath);
QuickFixTestCase(theTestFiles, factory, hps);
}
/// Delegates directly to AddIncludeForUndefinedIdentifierOp for easier testing.
class AddIncludeForUndefinedIdentifierTestFactory : public CppQuickFixFactory
{
......@@ -1289,7 +1297,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_afterClass()
testFiles << QuickFixTestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase(testFiles, &factory, QStringList(), 1);
QuickFixTestCase(testFiles, &factory, ProjectPart::HeaderPaths(), 1);
}
/// Check from header file: If there is a source file, insert the definition in the source file.
......@@ -1478,7 +1486,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass()
"};";
InsertDefFromDecl factory;
QuickFixTestCase(singleDocument(original, expected), &factory, QStringList(), 1);
QuickFixTestCase(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(), 1);
}
/// Check not triggering when definition exists
......@@ -1492,7 +1500,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
const QByteArray expected = original;
InsertDefFromDecl factory;
QuickFixTestCase test(singleDocument(original, expected), &factory, QStringList(), 1);
QuickFixTestCase test(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(),
1);
}
/// Find right implementation file.
......@@ -1910,7 +1919,7 @@ void insertToSectionDeclFromDef(const QByteArray &section, int sectionIndex)
testFiles << QuickFixTestDocument::create("file.cpp", original, expected);
InsertDeclFromDef factory;
QuickFixTestCase(testFiles, &factory, QStringList(), sectionIndex);
QuickFixTestCase(testFiles, &factory, ProjectPart::HeaderPaths(), sectionIndex);
}
/// Check from source file: Insert in header file.
......@@ -1961,7 +1970,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_normal()
// Do not use the test factory, at least once we want to go through the "full stack".
AddIncludeForUndefinedIdentifier factory;
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Ignore *.moc includes
......@@ -1986,7 +1995,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_ignoremoc()
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert include at top for a sorted group
......@@ -2012,7 +2021,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingTop(
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert include in the middle for a sorted group
......@@ -2038,7 +2047,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingMidd
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert include at bottom for a sorted group
......@@ -2064,7 +2073,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingBott
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: For an unsorted group the new include is appended
......@@ -2090,7 +2099,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_appendToUns
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert a local include at front if there are only global includes
......@@ -2117,7 +2126,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_firstLocalI
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert a global include at back if there are only local includes
......@@ -2146,7 +2155,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_firstGlobal
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<file.h>"));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Prefer group with longest matching prefix
......@@ -2176,7 +2185,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_preferGroup
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"prefixc.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Create a new include group if there are only include groups with a different include dir
......@@ -2203,7 +2212,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_newGroupIfO
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include dirs, sorted --> insert properly
......@@ -2231,7 +2240,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedDirsSo
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<firstlib/file.h>"));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include dirs, unsorted --> append
......@@ -2259,7 +2268,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedDirsUn
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<lastlib/file.h>"));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include types
......@@ -2285,7 +2294,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"z.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include types
......@@ -2311,7 +2320,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"a.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include types
......@@ -2337,7 +2346,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"lib/file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Include group with mixed include types
......@@ -2363,7 +2372,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<lib/file.h>"));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert very first include
......@@ -2386,7 +2395,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_noinclude()
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert very first include if there is a c++ style comment on top
......@@ -2415,7 +2424,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_veryFirstIn
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: Insert very first include if there is a c style comment on top
......@@ -2448,7 +2457,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_veryFirstIn
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
QuickFixTestCase::run(testFiles, &factory, TestIncludePaths::globalIncludePath());
}
/// Check: If a "Qt Class" was not found by the locator, check the header files in the Qt
......@@ -2472,8 +2481,8 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_checkQSomet
+ "/file.cpp", original, expected);