CppTools: Classify ambiguous headers depending on other files

This applies for all project managers, except qmake. The qmake project
manager will make use of this in follow up changes.

Before, "foo.h" was always recognized as a CXXHeader. Now, it depends on
the other files. E.g. in a file list {"foo.h", "foo.c"} foo.h is now a
CHeader. In {"foo.h", "foo.c", "bar.cpp"} the file "foo.h" is ambiguous
and we will create two project parts, one where it is a CHeader, the
other where it is a CXXHeader.

Change-Id: I50505163368742584b1380c284d42cbe07cb4fc9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-11-29 17:32:34 +01:00
parent f54d4fc3db
commit 3a369552c6
12 changed files with 328 additions and 42 deletions

View File

@@ -35,11 +35,13 @@ namespace CppTools {
class ProjectFileCategorizer
{
public:
using FileClassifier = ProjectPartBuilder::FileClassifier;
public:
ProjectFileCategorizer(const QString &projectPartName,
const QStringList &filePaths,
ProjectPartBuilder::FileClassifier fileClassifier
= ProjectPartBuilder::FileClassifier());
FileClassifier fileClassifier = FileClassifier());
bool hasCSources() const { return !m_cSources.isEmpty(); }
bool hasCxxSources() const { return !m_cxxSources.isEmpty(); }
@@ -56,6 +58,10 @@ public:
QString partName(const QString &languageName) const;
private:
QStringList classifyFiles(const QStringList &filePaths, FileClassifier fileClassifier);
void expandSourcesWithAmbiguousHeaders(const QStringList &ambiguousHeaders);
private:
QString m_partName;
ProjectFiles m_cSources;