forked from qt-creator/qt-creator
CppEditor: Proliferate FilePath use
This includes one functional change: It drops some cleaning of the path used to create the CppDocument, which is now assumed to be done on the caller side. Change-Id: I5e2a182028e4d5b56282ad85f4a5c665f081754f Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <QTextBlock>
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CppEditor::Internal {
|
||||
|
||||
@@ -42,13 +43,13 @@ static void applyRefactorings(QTextDocument *textDocument, TextEditorWidget *edi
|
||||
const CppCodeStyleSettings &settings)
|
||||
{
|
||||
// Preprocess source
|
||||
Environment env;
|
||||
CPlusPlus::Environment env;
|
||||
Preprocessor preprocess(nullptr, &env);
|
||||
FilePath noFileFile = FilePath::fromPathPart(u"<no-file>");
|
||||
const QByteArray preprocessedSource
|
||||
= preprocess.run(Utils::FilePath::fromParts({}, {}, u"<no-file>"),
|
||||
textDocument->toPlainText().toUtf8());
|
||||
= preprocess.run(noFileFile, textDocument->toPlainText().toUtf8());
|
||||
|
||||
Document::Ptr cppDocument = Document::create(QLatin1String("<no-file>"));
|
||||
Document::Ptr cppDocument = Document::create(noFileFile);
|
||||
cppDocument->setUtf8Source(preprocessedSource);
|
||||
cppDocument->parse(Document::ParseTranlationUnit);
|
||||
cppDocument->check();
|
||||
|
||||
Reference in New Issue
Block a user