forked from qt-creator/qt-creator
Merge CppTools into CppEditor
There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -51,9 +51,9 @@ static QString updatedPathFlag(const QString &pathStr, const QString &workingDir
|
||||
return result;
|
||||
}
|
||||
|
||||
static CppTools::ProjectFile::Kind fileKindFromString(QString flag)
|
||||
static CppEditor::ProjectFile::Kind fileKindFromString(QString flag)
|
||||
{
|
||||
using namespace CppTools;
|
||||
using namespace CppEditor;
|
||||
if (flag.startsWith("-x"))
|
||||
flag = flag.mid(2);
|
||||
|
||||
@@ -101,7 +101,7 @@ void filteredFlags(const QString &fileName,
|
||||
QStringList &flags,
|
||||
HeaderPaths &headerPaths,
|
||||
Macros ¯os,
|
||||
CppTools::ProjectFile::Kind &fileKind,
|
||||
CppEditor::ProjectFile::Kind &fileKind,
|
||||
QString &sysRoot)
|
||||
{
|
||||
if (flags.empty())
|
||||
@@ -197,12 +197,12 @@ void filteredFlags(const QString &fileName,
|
||||
}
|
||||
|
||||
if ((flag.startsWith("-std=") || flag.startsWith("/std:"))
|
||||
&& fileKind == CppTools::ProjectFile::Unclassified) {
|
||||
&& fileKind == CppEditor::ProjectFile::Unclassified) {
|
||||
const bool cpp = (flag.contains("c++") || flag.contains("gnu++"));
|
||||
if (CppTools::ProjectFile::isHeader(CppTools::ProjectFile::classify(fileName)))
|
||||
fileKind = cpp ? CppTools::ProjectFile::CXXHeader : CppTools::ProjectFile::CHeader;
|
||||
if (CppEditor::ProjectFile::isHeader(CppEditor::ProjectFile::classify(fileName)))
|
||||
fileKind = cpp ? CppEditor::ProjectFile::CXXHeader : CppEditor::ProjectFile::CHeader;
|
||||
else
|
||||
fileKind = cpp ? CppTools::ProjectFile::CXXSource : CppTools::ProjectFile::CSource;
|
||||
fileKind = cpp ? CppEditor::ProjectFile::CXXSource : CppEditor::ProjectFile::CSource;
|
||||
}
|
||||
|
||||
// Skip all remaining Windows flags except feature flags.
|
||||
@@ -212,8 +212,8 @@ void filteredFlags(const QString &fileName,
|
||||
filtered.push_back(flag);
|
||||
}
|
||||
|
||||
if (fileKind == CppTools::ProjectFile::Unclassified)
|
||||
fileKind = CppTools::ProjectFile::classify(fileName);
|
||||
if (fileKind == CppEditor::ProjectFile::Unclassified)
|
||||
fileKind = CppEditor::ProjectFile::classify(fileName);
|
||||
|
||||
flags = filtered;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user