forked from qt-creator/qt-creator
CplusPlus: Pass FilePath to Preprocessor::run()
... and update caller sides. Change-Id: I6a107e4a7fd9f7123cdc6f141da202845bcbbb66 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,16 +50,15 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
|
||||
return preprocessed;
|
||||
}
|
||||
|
||||
void FastPreprocessor::sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||
const QStringList &initialIncludes)
|
||||
void FastPreprocessor::sourceNeeded(int line, const FilePath &filePath, IncludeType mode,
|
||||
const FilePaths &initialIncludes)
|
||||
{
|
||||
Q_UNUSED(initialIncludes)
|
||||
Q_ASSERT(_currentDoc);
|
||||
FilePath filePath = FilePath::fromString(fileName);
|
||||
if (_addIncludesToCurrentDoc) {
|
||||
// CHECKME: Is that cleanPath needed?
|
||||
const FilePath cleanPath = filePath.cleanPath();
|
||||
_currentDoc->addIncludeFile(Document::Include(fileName, cleanPath, line, mode));
|
||||
_currentDoc->addIncludeFile(Document::Include(filePath.toString(), cleanPath, line, mode));
|
||||
}
|
||||
mergeEnvironment(filePath);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
bool mergeDefinedMacrosOfDocument = false);
|
||||
|
||||
// CPlusPlus::Client
|
||||
virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||
const QStringList &initialIncludes = QStringList());
|
||||
virtual void sourceNeeded(int line, const Utils::FilePath &filePath, IncludeType mode,
|
||||
const Utils::FilePaths &initialIncludes = {});
|
||||
|
||||
virtual void macroAdded(const Macro &);
|
||||
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
|
||||
#include <cplusplus/CPlusPlusForwardDeclarations.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QByteArray;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
class ByteArrayRef;
|
||||
@@ -74,8 +72,7 @@ public:
|
||||
|
||||
virtual void startExpandingMacro(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals
|
||||
= QVector<MacroArgumentReference>()) = 0;
|
||||
const QVector<MacroArgumentReference> &actuals = {}) = 0;
|
||||
virtual void stopExpandingMacro(int bytesOffset, const Macro ¯o) = 0; // TODO: ?!
|
||||
|
||||
/// Mark the given macro name as the include guard for the current file.
|
||||
@@ -85,8 +82,8 @@ public:
|
||||
virtual void startSkippingBlocks(int utf16charsOffset) = 0;
|
||||
virtual void stopSkippingBlocks(int utf16charsOffset) = 0;
|
||||
|
||||
virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||
const QStringList &initialIncludes = QStringList()) = 0;
|
||||
virtual void sourceNeeded(int line, const Utils::FilePath &fileName, IncludeType mode,
|
||||
const Utils::FilePaths &initialIncludes = {}) = 0;
|
||||
|
||||
static inline bool isInjectedFile(const QString &fileName)
|
||||
{
|
||||
|
||||
@@ -1687,7 +1687,7 @@ void Preprocessor::handleIncludeDirective(PPToken *tk, bool includeNext)
|
||||
|
||||
if (m_client) {
|
||||
QString inc = QString::fromUtf8(included.constData() + 1, included.size() - 2);
|
||||
m_client->sourceNeeded(line, inc, mode);
|
||||
m_client->sourceNeeded(line, FilePath::fromString(inc), mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user