ProjectExplorer: Rename IncludePathType to HeaderPathType

It is the type used by the HeaderPath class, so reflect that in
the name.

I also considered to rename HeaderPath to IncludePath, but
that name is reflected in a lot of users, which would also need
to be adjusted for consistency. That would blow up the patch size
for little value IMHO.

Change-Id: I51421dbd3ab8b2874dc32fc82dc394c9b93ce5e9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Tobias Hunger
2018-09-13 11:44:43 +02:00
parent 292cc7c816
commit 1df553a683
20 changed files with 65 additions and 65 deletions

View File

@@ -120,14 +120,14 @@ static void addSystemHeaderPaths(QList<ProjectExplorer::HeaderPath> &paths,
Utils::FileName includePath = stdcppPath; Utils::FileName includePath = stdcppPath;
Utils::FileName cppLibsPath = stdcppPath; Utils::FileName cppLibsPath = stdcppPath;
cppLibsPath.appendPath("libs/" + getArch(triple) + "/include/"); cppLibsPath.appendPath("libs/" + getArch(triple) + "/include/");
paths.prepend({cppLibsPath.toString(), ProjectExplorer::IncludePathType::System}); paths.prepend({cppLibsPath.toString(), ProjectExplorer::HeaderPathType::System});
includePath.appendPath("include/"); includePath.appendPath("include/");
paths.prepend({includePath.toString(), ProjectExplorer::IncludePathType::System}); paths.prepend({includePath.toString(), ProjectExplorer::HeaderPathType::System});
paths.prepend({ndkPath.toString() + "/sysroot/usr/include/" + triple, paths.prepend({ndkPath.toString() + "/sysroot/usr/include/" + triple,
ProjectExplorer::IncludePathType::System}); ProjectExplorer::HeaderPathType::System});
paths.prepend({ndkPath.toString() + "/sysroot/usr/include", paths.prepend({ndkPath.toString() + "/sysroot/usr/include",
ProjectExplorer::IncludePathType::System}); ProjectExplorer::HeaderPathType::System});
} }
AndroidToolChain::SystemHeaderPathsRunner AndroidToolChain::createSystemHeaderPathsRunner() const AndroidToolChain::SystemHeaderPathsRunner AndroidToolChain::createSystemHeaderPathsRunner() const

View File

@@ -467,7 +467,7 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
// Make completion for all relevant includes // Make completion for all relevant includes
ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths(); ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths();
const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(), const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
ProjectExplorer::IncludePathType::User); ProjectExplorer::HeaderPathType::User);
if (!headerPaths.contains(currentFilePath)) if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath); headerPaths.append(currentFilePath);

View File

@@ -96,7 +96,7 @@ static const ProjectExplorer::HeaderPaths toHeaderPaths(const QStringList &paths
{ {
ProjectExplorer::HeaderPaths result; ProjectExplorer::HeaderPaths result;
foreach (const QString &path, paths) foreach (const QString &path, paths)
result.push_back({path, ProjectExplorer::IncludePathType::User}); result.push_back({path, ProjectExplorer::HeaderPathType::User});
return result; return result;
} }

View File

@@ -270,7 +270,7 @@ void QuickFixOperationTest::run(const QList<QuickFixTestDocument::Ptr> &testDocu
int operationIndex) int operationIndex)
{ {
ProjectExplorer::HeaderPaths headerPaths; ProjectExplorer::HeaderPaths headerPaths;
headerPaths.push_back({headerPath, ProjectExplorer::IncludePathType::User}); headerPaths.push_back({headerPath, ProjectExplorer::HeaderPathType::User});
QuickFixOperationTest(testDocuments, factory, headerPaths, operationIndex); QuickFixOperationTest(testDocuments, factory, headerPaths, operationIndex);
} }
@@ -3673,7 +3673,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_noDoubleQtH
testDocuments << QuickFixTestDocument::create(base + "/fileWantsToUseQDir.cpp", original, expected); testDocuments << QuickFixTestDocument::create(base + "/fileWantsToUseQDir.cpp", original, expected);
ProjectExplorer::HeaderPaths headerPaths{{TestIncludePaths::globalQtCoreIncludePath(), ProjectExplorer::HeaderPaths headerPaths{{TestIncludePaths::globalQtCoreIncludePath(),
ProjectExplorer::IncludePathType::User}}; ProjectExplorer::HeaderPathType::User}};
AddIncludeForUndefinedIdentifier factory; AddIncludeForUndefinedIdentifier factory;
const QStringList expectedOperations = QStringList("Add #include <QDir>"); const QStringList expectedOperations = QStringList("Add #include <QDir>");

View File

@@ -198,7 +198,7 @@ void CompilerOptionsBuilder::enableExceptions()
void CompilerOptionsBuilder::addHeaderPathOptions() void CompilerOptionsBuilder::addHeaderPathOptions()
{ {
using ProjectExplorer::IncludePathType; using ProjectExplorer::HeaderPathType;
QStringList result; QStringList result;
@@ -212,15 +212,15 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
QString prefix; QString prefix;
Utils::FileName path; Utils::FileName path;
switch (headerPath.type) { switch (headerPath.type) {
case IncludePathType::Framework: case HeaderPathType::Framework:
prefix = QLatin1String("-F"); prefix = QLatin1String("-F");
break; break;
case IncludePathType::System: case HeaderPathType::System:
prefix = "-isystem"; prefix = "-isystem";
break; break;
default: // This shouldn't happen, but let's be nice..: default: // This shouldn't happen, but let's be nice..:
// intentional fall-through: // intentional fall-through:
case IncludePathType::User: case HeaderPathType::User:
prefix = includeDirOptionForPath(headerPath.path); prefix = includeDirOptionForPath(headerPath.path);
break; break;
} }

View File

@@ -89,9 +89,9 @@ QString Utils::toString(CPlusPlus::Document::DiagnosticMessage::Level level)
return QString(); return QString();
} }
QString Utils::toString(ProjectExplorer::IncludePathType type) QString Utils::toString(ProjectExplorer::HeaderPathType type)
{ {
#define CASE_LANGUAGEVERSION(x) case ProjectExplorer::IncludePathType::x: return QLatin1String(#x"Path") #define CASE_LANGUAGEVERSION(x) case ProjectExplorer::HeaderPathType::x: return QLatin1String(#x"Path")
switch (type) { switch (type) {
CASE_LANGUAGEVERSION(Invalid); CASE_LANGUAGEVERSION(Invalid);
CASE_LANGUAGEVERSION(User); CASE_LANGUAGEVERSION(User);
@@ -466,14 +466,14 @@ Dumper::~Dumper()
m_out << "*** END Code Model Inspection Report\n"; m_out << "*** END Code Model Inspection Report\n";
} }
static void printIncludeType(QTextStream &out, ProjectExplorer::IncludePathType type) static void printIncludeType(QTextStream &out, ProjectExplorer::HeaderPathType type)
{ {
using ProjectExplorer::IncludePathType; using ProjectExplorer::HeaderPathType;
switch (type) { switch (type) {
case IncludePathType::Invalid: out << "(invalid include path)"; break; case HeaderPathType::Invalid: out << "(invalid include path)"; break;
case IncludePathType::User: out << "(user include path)"; break; case HeaderPathType::User: out << "(user include path)"; break;
case IncludePathType::System: out << "(system include path)"; break; case HeaderPathType::System: out << "(system include path)"; break;
case IncludePathType::Framework: out << "(framework path)"; break; case HeaderPathType::Framework: out << "(framework path)"; break;
} }
} }

View File

@@ -46,7 +46,7 @@ struct CPPTOOLS_EXPORT Utils
static QString toString(const QDateTime &dateTime); static QString toString(const QDateTime &dateTime);
static QString toString(CPlusPlus::Document::CheckMode checkMode); static QString toString(CPlusPlus::Document::CheckMode checkMode);
static QString toString(CPlusPlus::Document::DiagnosticMessage::Level level); static QString toString(CPlusPlus::Document::DiagnosticMessage::Level level);
static QString toString(ProjectExplorer::IncludePathType type); static QString toString(ProjectExplorer::HeaderPathType type);
static QString toString(CppTools::ProjectPart::LanguageVersion languageVersion); static QString toString(CppTools::ProjectPart::LanguageVersion languageVersion);
static QString toString(CppTools::ProjectPart::LanguageExtensions languageExtension); static QString toString(CppTools::ProjectPart::LanguageExtensions languageExtension);
static QString toString(CppTools::ProjectPart::QtVersion qtVersion); static QString toString(CppTools::ProjectPart::QtVersion qtVersion);

View File

@@ -1260,7 +1260,7 @@ bool InternalCppCompletionAssistProcessor::completeInclude(const QTextCursor &cu
// Make completion for all relevant includes // Make completion for all relevant includes
ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths(); ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths();
const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(), const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
ProjectExplorer::IncludePathType::User); ProjectExplorer::HeaderPathType::User);
if (!headerPaths.contains(currentFilePath)) if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath); headerPaths.append(currentFilePath);

View File

@@ -186,16 +186,16 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
ProjectPart::Ptr part(new ProjectPart); ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5; part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {ProjectExplorer::Macro("OH_BEHAVE", "-1")}; part->projectMacros = {ProjectExplorer::Macro("OH_BEHAVE", "-1")};
part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User}, part->headerPaths = {{testDataDir.includeDir(false), HeaderPathType::User},
{testDataDir.frameworksDir(false), IncludePathType::Framework}}; {testDataDir.frameworksDir(false), HeaderPathType::Framework}};
pi.appendProjectPart(part); pi.appendProjectPart(part);
mm->updateProjectInfo(pi); mm->updateProjectInfo(pi);
ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths(); ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths();
QCOMPARE(headerPaths.size(), 2); QCOMPARE(headerPaths.size(), 2);
QVERIFY(headerPaths.contains({testDataDir.includeDir(), IncludePathType::User})); QVERIFY(headerPaths.contains({testDataDir.includeDir(), HeaderPathType::User}));
QVERIFY(headerPaths.contains({testDataDir.frameworksDir(), IncludePathType::Framework})); QVERIFY(headerPaths.contains({testDataDir.frameworksDir(), HeaderPathType::Framework}));
} }
/// Check: Frameworks headers are resolved. /// Check: Frameworks headers are resolved.
@@ -215,8 +215,8 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
ProjectPart::Ptr part(new ProjectPart); ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5; part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {{"OH_BEHAVE", "-1"}}; part->projectMacros = {{"OH_BEHAVE", "-1"}};
part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User}, part->headerPaths = {{testDataDir.includeDir(false), HeaderPathType::User},
{testDataDir.frameworksDir(false), IncludePathType::Framework}}; {testDataDir.frameworksDir(false), HeaderPathType::Framework}};
const QString &source = testDataDir.fileFromSourcesDir( const QString &source = testDataDir.fileFromSourcesDir(
_("test_modelmanager_framework_headers.cpp")); _("test_modelmanager_framework_headers.cpp"));
part->files << ProjectFile(source, ProjectFile::CXXSource); part->files << ProjectFile(source, ProjectFile::CXXSource);
@@ -262,7 +262,7 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
ProjectPart::Ptr part(new ProjectPart); ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5; part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {{"OH_BEHAVE", "-1"}}; part->projectMacros = {{"OH_BEHAVE", "-1"}};
part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User}}; part->headerPaths = {{testDataDir.includeDir(false), HeaderPathType::User}};
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource)); part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part); pi.appendProjectPart(part);
@@ -754,7 +754,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt; part1->qtVersion = ProjectPart::NoQt;
part1->projectMacros = {{"SUB1"}}; part1->projectMacros = {{"SUB1"}};
part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part1->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
ProjectPart::Ptr part2(new ProjectPart); ProjectPart::Ptr part2(new ProjectPart);
part2->projectFile = QLatin1String("project1.projectfile"); part2->projectFile = QLatin1String("project1.projectfile");
@@ -762,7 +762,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt; part2->qtVersion = ProjectPart::NoQt;
part2->projectMacros = {{"SUB2"}}; part2->projectMacros = {{"SUB2"}};
part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part2->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
ProjectInfo pi = ProjectInfo(project); ProjectInfo pi = ProjectInfo(project);
pi.appendProjectPart(part1); pi.appendProjectPart(part1);
@@ -818,7 +818,7 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt; part1->qtVersion = ProjectPart::NoQt;
part1->precompiledHeaders.append(pch1File); part1->precompiledHeaders.append(pch1File);
part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part1->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
part1->updateLanguageFeatures(); part1->updateLanguageFeatures();
ProjectPart::Ptr part2(new ProjectPart); ProjectPart::Ptr part2(new ProjectPart);
@@ -827,7 +827,7 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt; part2->qtVersion = ProjectPart::NoQt;
part2->precompiledHeaders.append(pch2File); part2->precompiledHeaders.append(pch2File);
part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part2->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
part2->updateLanguageFeatures(); part2->updateLanguageFeatures();
ProjectInfo pi = ProjectInfo(project); ProjectInfo pi = ProjectInfo(project);
@@ -899,13 +899,13 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource)); part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt; part1->qtVersion = ProjectPart::NoQt;
part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part1->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
ProjectPart::Ptr part2(new ProjectPart); ProjectPart::Ptr part2(new ProjectPart);
part2->files.append(ProjectFile(main2File, ProjectFile::CXXSource)); part2->files.append(ProjectFile(main2File, ProjectFile::CXXSource));
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader)); part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt; part2->qtVersion = ProjectPart::NoQt;
part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}}; part2->headerPaths = {{testDataDirectory.includeDir(false), HeaderPathType::User}};
ProjectInfo pi = ProjectInfo(project); ProjectInfo pi = ProjectInfo(project);
pi.appendProjectPart(part1); pi.appendProjectPart(part1);

View File

@@ -96,7 +96,7 @@ void RawProjectPart::setIncludePaths(const QStringList &includePaths)
headerPaths.clear(); headerPaths.clear();
foreach (const QString &includeFile, includePaths) { foreach (const QString &includeFile, includePaths) {
ProjectExplorer::HeaderPath hp(includeFile, ProjectExplorer::IncludePathType::User); ProjectExplorer::HeaderPath hp(includeFile, ProjectExplorer::HeaderPathType::User);
// The simple project managers are utterly ignorant of frameworks on macOS, and won't report // The simple project managers are utterly ignorant of frameworks on macOS, and won't report
// framework paths. The work-around is to check if the include path ends in ".framework", // framework paths. The work-around is to check if the include path ends in ".framework",
@@ -104,7 +104,7 @@ void RawProjectPart::setIncludePaths(const QStringList &includePaths)
if (includeFile.endsWith(QLatin1String(".framework"))) { if (includeFile.endsWith(QLatin1String(".framework"))) {
const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/')); const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
if (slashIdx != -1) { if (slashIdx != -1) {
hp = {includeFile.left(slashIdx), ProjectExplorer::IncludePathType::Framework}; hp = {includeFile.left(slashIdx), ProjectExplorer::HeaderPathType::Framework};
} }
} }

View File

@@ -132,13 +132,13 @@ void CppSourceProcessor::setWorkingCopy(const WorkingCopy &workingCopy)
void CppSourceProcessor::setHeaderPaths(const ProjectExplorer::HeaderPaths &headerPaths) void CppSourceProcessor::setHeaderPaths(const ProjectExplorer::HeaderPaths &headerPaths)
{ {
using ProjectExplorer::IncludePathType; using ProjectExplorer::HeaderPathType;
m_headerPaths.clear(); m_headerPaths.clear();
for (int i = 0, ei = headerPaths.size(); i < ei; ++i) { for (int i = 0, ei = headerPaths.size(); i < ei; ++i) {
const ProjectExplorer::HeaderPath &path = headerPaths.at(i); const ProjectExplorer::HeaderPath &path = headerPaths.at(i);
if (path.type == IncludePathType::User || path.type == IncludePathType::System) if (path.type == HeaderPathType::User || path.type == HeaderPathType::System)
m_headerPaths.append({cleanPath(path.path), path.type}); m_headerPaths.append({cleanPath(path.path), path.type});
else else
addFrameworkPath(path); addFrameworkPath(path);
@@ -165,7 +165,7 @@ void CppSourceProcessor::addFrameworkPath(const ProjectExplorer::HeaderPath &fra
// in the frameworks we're linking against. If we would have that, then we could // in the frameworks we're linking against. If we would have that, then we could
// add only those private frameworks. // add only those private frameworks.
const ProjectExplorer::HeaderPath cleanFrameworkPath(cleanPath(frameworkPath.path), const ProjectExplorer::HeaderPath cleanFrameworkPath(cleanPath(frameworkPath.path),
ProjectExplorer::IncludePathType::Framework); ProjectExplorer::HeaderPathType::Framework);
if (!m_headerPaths.contains(cleanFrameworkPath)) if (!m_headerPaths.contains(cleanFrameworkPath))
m_headerPaths.append(cleanFrameworkPath); m_headerPaths.append(cleanFrameworkPath);
@@ -178,7 +178,7 @@ void CppSourceProcessor::addFrameworkPath(const ProjectExplorer::HeaderPath &fra
QLatin1String("Frameworks")); QLatin1String("Frameworks"));
if (privateFrameworks.exists() && privateFrameworks.isDir()) if (privateFrameworks.exists() && privateFrameworks.isDir())
addFrameworkPath({privateFrameworks.absoluteFilePath(), addFrameworkPath({privateFrameworks.absoluteFilePath(),
ProjectExplorer::IncludePathType::Framework}); ProjectExplorer::HeaderPathType::Framework});
} }
} }

View File

@@ -47,7 +47,7 @@ using namespace CPlusPlus;
using namespace CppTools; using namespace CppTools;
using namespace CppTools::Tests; using namespace CppTools::Tests;
using namespace CppTools::Internal; using namespace CppTools::Internal;
using ProjectExplorer::IncludePathType; using ProjectExplorer::HeaderPathType;
typedef Document::Include Include; typedef Document::Include Include;
@@ -65,7 +65,7 @@ public:
QScopedPointer<CppSourceProcessor> sourceProcessor( QScopedPointer<CppSourceProcessor> sourceProcessor(
CppModelManager::createSourceProcessor()); CppModelManager::createSourceProcessor());
const ProjectExplorer::HeaderPath hp(TestIncludePaths::directoryOfTestFile(), const ProjectExplorer::HeaderPath hp(TestIncludePaths::directoryOfTestFile(),
IncludePathType::User); HeaderPathType::User);
sourceProcessor->setHeaderPaths({hp}); sourceProcessor->setHeaderPaths({hp});
sourceProcessor->run(filePath); sourceProcessor->run(filePath);
@@ -208,8 +208,8 @@ void CppToolsPlugin::test_cppsourceprocessor_includeNext()
CppSourceProcessor::DocumentCallback documentCallback = [](const Document::Ptr &){}; CppSourceProcessor::DocumentCallback documentCallback = [](const Document::Ptr &){};
CppSourceProcessor sourceProcessor(Snapshot(), documentCallback); CppSourceProcessor sourceProcessor(Snapshot(), documentCallback);
ProjectExplorer::HeaderPaths headerPaths = {{customHeaderPath, IncludePathType::User}, ProjectExplorer::HeaderPaths headerPaths = {{customHeaderPath, HeaderPathType::User},
{systemHeaderPath, IncludePathType::User}}; {systemHeaderPath, HeaderPathType::User}};
sourceProcessor.setHeaderPaths(headerPaths); sourceProcessor.setHeaderPaths(headerPaths);
sourceProcessor.run(mainFilePath); sourceProcessor.run(mainFilePath);

View File

@@ -535,7 +535,7 @@ static QList<Include> includesForSource(const QString &filePath)
cmm->GC(); cmm->GC();
QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor()); QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor());
sourceProcessor->setHeaderPaths({{TestIncludePaths::globalIncludePath(), sourceProcessor->setHeaderPaths({{TestIncludePaths::globalIncludePath(),
ProjectExplorer::IncludePathType::User}}); ProjectExplorer::HeaderPathType::User}});
sourceProcessor->run(filePath); sourceProcessor->run(filePath);
Document::Ptr document = cmm->document(filePath); Document::Ptr document = cmm->document(filePath);

View File

@@ -219,7 +219,7 @@ ToolChain::SystemHeaderPathsRunner AbstractMsvcToolChain::createSystemHeaderPath
QMutexLocker locker(m_headerPathsMutex); QMutexLocker locker(m_headerPathsMutex);
if (m_headerPaths.isEmpty()) { if (m_headerPaths.isEmpty()) {
foreach (const QString &path, env.value(QLatin1String("INCLUDE")).split(QLatin1Char(';'))) foreach (const QString &path, env.value(QLatin1String("INCLUDE")).split(QLatin1Char(';')))
m_headerPaths.append({path, IncludePathType::System}); m_headerPaths.append({path, HeaderPathType::System});
} }
return m_headerPaths; return m_headerPaths;
}; };

View File

@@ -175,7 +175,7 @@ ToolChain::SystemHeaderPathsRunner CustomToolChain::createSystemHeaderPathsRunne
QList<HeaderPath> flagHeaderPaths; QList<HeaderPath> flagHeaderPaths;
for (const QString &cxxFlag : cxxFlags) { for (const QString &cxxFlag : cxxFlags) {
if (cxxFlag.startsWith(QLatin1String("-I"))) { if (cxxFlag.startsWith(QLatin1String("-I"))) {
flagHeaderPaths.push_back({cxxFlag.mid(2).trimmed(), IncludePathType::System}); flagHeaderPaths.push_back({cxxFlag.mid(2).trimmed(), HeaderPathType::System});
} }
} }
@@ -228,7 +228,7 @@ QStringList CustomToolChain::headerPathsList() const
void CustomToolChain::setHeaderPaths(const QStringList &list) void CustomToolChain::setHeaderPaths(const QStringList &list)
{ {
QList<HeaderPath> tmp = Utils::transform(list, [](const QString &headerPath) { QList<HeaderPath> tmp = Utils::transform(list, [](const QString &headerPath) {
return HeaderPath(headerPath.trimmed(), IncludePathType::System); return HeaderPath(headerPath.trimmed(), HeaderPathType::System);
}); });
if (m_systemHeaderPaths == tmp) if (m_systemHeaderPaths == tmp)

View File

@@ -151,20 +151,20 @@ QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStrin
} }
if (!line.isEmpty() && line.startsWith("#include")) { if (!line.isEmpty() && line.startsWith("#include")) {
auto kind = IncludePathType::User; auto kind = HeaderPathType::User;
while (cpp.canReadLine()) { while (cpp.canReadLine()) {
line = cpp.readLine(); line = cpp.readLine();
if (line.startsWith("#include")) { if (line.startsWith("#include")) {
kind = IncludePathType::System; kind = HeaderPathType::System;
} else if (! line.isEmpty() && QChar(line.at(0)).isSpace()) { } else if (! line.isEmpty() && QChar(line.at(0)).isSpace()) {
IncludePathType thisHeaderKind = kind; HeaderPathType thisHeaderKind = kind;
line = line.trimmed(); line = line.trimmed();
const int index = line.indexOf(" (framework directory)"); const int index = line.indexOf(" (framework directory)");
if (index != -1) { if (index != -1) {
line.truncate(index); line.truncate(index);
thisHeaderKind = IncludePathType::Framework; thisHeaderKind = HeaderPathType::Framework;
} }
const QString headerPath = QFileInfo(QFile::decodeName(line)).canonicalFilePath(); const QString headerPath = QFileInfo(QFile::decodeName(line)).canonicalFilePath();

View File

@@ -30,7 +30,7 @@
namespace ProjectExplorer { namespace ProjectExplorer {
enum class IncludePathType { enum class HeaderPathType {
Invalid, Invalid,
User, User,
System, System,
@@ -41,18 +41,18 @@ class HeaderPath
{ {
public: public:
HeaderPath() = default; HeaderPath() = default;
HeaderPath(const QString &path, IncludePathType type) HeaderPath(const QString &path, HeaderPathType type)
: path(path), type(type) : path(path), type(type)
{ } { }
bool isValid() const bool isValid() const
{ {
return type != IncludePathType::Invalid; return type != HeaderPathType::Invalid;
} }
bool isFrameworkPath() const bool isFrameworkPath() const
{ {
return type == IncludePathType::Framework; return type == HeaderPathType::Framework;
} }
bool operator==(const HeaderPath &other) const bool operator==(const HeaderPath &other) const
@@ -66,7 +66,7 @@ public:
} }
QString path; QString path;
IncludePathType type = IncludePathType::Invalid; HeaderPathType type = HeaderPathType::Invalid;
}; };
inline uint qHash(const HeaderPath &key, uint seed = 0) inline uint qHash(const HeaderPath &key, uint seed = 0)

View File

@@ -983,7 +983,7 @@ void QbsProject::updateCppCodeModel()
list.removeDuplicates(); list.removeDuplicates();
ProjectExplorer::HeaderPaths grpHeaderPaths; ProjectExplorer::HeaderPaths grpHeaderPaths;
foreach (const QString &p, list) foreach (const QString &p, list)
grpHeaderPaths += {FileName::fromUserInput(p).toString(), IncludePathType::User}; grpHeaderPaths += {FileName::fromUserInput(p).toString(), HeaderPathType::User};
list = props.getModulePropertiesAsStringList(QLatin1String(CONFIG_CPP_MODULE), list = props.getModulePropertiesAsStringList(QLatin1String(CONFIG_CPP_MODULE),
QLatin1String(CONFIG_FRAMEWORKPATHS)); QLatin1String(CONFIG_FRAMEWORKPATHS));
@@ -991,7 +991,7 @@ void QbsProject::updateCppCodeModel()
QLatin1String(CONFIG_SYSTEM_FRAMEWORKPATHS))); QLatin1String(CONFIG_SYSTEM_FRAMEWORKPATHS)));
list.removeDuplicates(); list.removeDuplicates();
foreach (const QString &p, list) foreach (const QString &p, list)
grpHeaderPaths += {FileName::fromUserInput(p).toString(), IncludePathType::Framework}; grpHeaderPaths += {FileName::fromUserInput(p).toString(), HeaderPathType::Framework};
rpp.setHeaderPaths(grpHeaderPaths); rpp.setHeaderPaths(grpHeaderPaths);

View File

@@ -315,13 +315,13 @@ void QmakeProject::updateCppCodeModel()
// Header paths // Header paths
ProjectExplorer::HeaderPaths headerPaths; ProjectExplorer::HeaderPaths headerPaths;
foreach (const QString &inc, pro->variableValue(Variable::IncludePath)) { foreach (const QString &inc, pro->variableValue(Variable::IncludePath)) {
const ProjectExplorer::HeaderPath headerPath{inc, IncludePathType::User}; const ProjectExplorer::HeaderPath headerPath{inc, HeaderPathType::User};
if (!headerPaths.contains(headerPath)) if (!headerPaths.contains(headerPath))
headerPaths += headerPath; headerPaths += headerPath;
} }
if (qtVersion && !qtVersion->frameworkInstallPath().isEmpty()) { if (qtVersion && !qtVersion->frameworkInstallPath().isEmpty()) {
headerPaths += {qtVersion->frameworkInstallPath(), IncludePathType::Framework}; headerPaths += {qtVersion->frameworkInstallPath(), HeaderPathType::Framework};
} }
rpp.setHeaderPaths(headerPaths); rpp.setHeaderPaths(headerPaths);

View File

@@ -253,10 +253,10 @@ TEST_F(ProjectUpdater, CreateSortedCompilerMacros)
TEST_F(ProjectUpdater, CreateSortedIncludeSearchPaths) TEST_F(ProjectUpdater, CreateSortedIncludeSearchPaths)
{ {
ProjectExplorer::HeaderPath includePath{"/to/path1", ProjectExplorer::IncludePathType::User}; ProjectExplorer::HeaderPath includePath{"/to/path1", ProjectExplorer::HeaderPathType::User};
ProjectExplorer::HeaderPath includePath2{"/to/path2", ProjectExplorer::IncludePathType::User}; ProjectExplorer::HeaderPath includePath2{"/to/path2", ProjectExplorer::HeaderPathType::User};
ProjectExplorer::HeaderPath invalidPath; ProjectExplorer::HeaderPath invalidPath;
ProjectExplorer::HeaderPath frameworkPath{"/framework/path", ProjectExplorer::IncludePathType::Framework}; ProjectExplorer::HeaderPath frameworkPath{"/framework/path", ProjectExplorer::HeaderPathType::Framework};
auto paths = updater.createIncludeSearchPaths({frameworkPath, includePath2, includePath, invalidPath}); auto paths = updater.createIncludeSearchPaths({frameworkPath, includePath2, includePath, invalidPath});