forked from qt-creator/qt-creator
CppEditor: Use FilePath for ProjectPath::m_sourceFiles
... and update using code. Change-Id: I682727a4b2982dba388e7cc7b9488225748d591f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -81,6 +81,7 @@ using namespace LanguageClient;
|
||||
using namespace LanguageServerProtocol;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
@@ -341,7 +342,7 @@ static void addToCompilationDb(QJsonObject &cdb,
|
||||
// Should we make use of them or keep using our own?
|
||||
args.prepend("clang");
|
||||
|
||||
const QString fileString = Utils::FilePath::fromString(sourceFile.path).toUserOutput();
|
||||
const QString fileString = sourceFile.path.toUserOutput();
|
||||
args.append(fileString);
|
||||
QJsonObject value;
|
||||
value.insert("workingDirectory", workingDir.toString());
|
||||
@@ -819,7 +820,7 @@ void ClangdClient::updateParserConfig(const Utils::FilePath &filePath,
|
||||
CppEditor::CompilerOptionsBuilder optionsBuilder = clangOptionsBuilder(
|
||||
*projectPart, warningsConfigForProject(project()), includeDir,
|
||||
ProjectExplorer::Macro::toMacros(config.editorDefines));
|
||||
const CppEditor::ProjectFile file(filePath.toString(),
|
||||
const CppEditor::ProjectFile file(filePath,
|
||||
CppEditor::ProjectFile::classify(filePath.toString()));
|
||||
const QJsonArray projectPartOptions = fullProjectPartOptions(
|
||||
optionsBuilder, globalClangOptions());
|
||||
@@ -833,7 +834,7 @@ void ClangdClient::updateParserConfig(const Utils::FilePath &filePath,
|
||||
emit configChanged();
|
||||
}
|
||||
|
||||
void ClangdClient::switchIssuePaneEntries(const Utils::FilePath &filePath)
|
||||
void ClangdClient::switchIssuePaneEntries(const FilePath &filePath)
|
||||
{
|
||||
TaskHub::clearTasks(Constants::TASK_CATEGORY_DIAGNOSTICS);
|
||||
const Tasks tasks = d->issuePaneEntries.value(filePath);
|
||||
|
||||
@@ -110,13 +110,13 @@ static QJsonObject createFileObject(const FilePath &buildDir,
|
||||
bool clStyle)
|
||||
{
|
||||
QJsonObject fileObject;
|
||||
fileObject["file"] = projFile.path;
|
||||
fileObject["file"] = projFile.path.toString();
|
||||
QJsonArray args;
|
||||
|
||||
if (purpose == CompilationDbPurpose::Project) {
|
||||
args = QJsonArray::fromStringList(arguments);
|
||||
|
||||
const ProjectFile::Kind kind = ProjectFile::classify(projFile.path);
|
||||
const ProjectFile::Kind kind = ProjectFile::classify(projFile.path.path());
|
||||
if (projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID
|
||||
|| projectPart.toolchainType == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) {
|
||||
if (!ProjectFile::isObjC(kind)) {
|
||||
@@ -138,7 +138,7 @@ static QJsonObject createFileObject(const FilePath &buildDir,
|
||||
args.prepend("clang"); // TODO: clang-cl for MSVC targets? Does it matter at all what we put here?
|
||||
}
|
||||
|
||||
args.append(QDir::toNativeSeparators(projFile.path));
|
||||
args.append(projFile.path.toUserOutput());
|
||||
fileObject["arguments"] = args;
|
||||
fileObject["directory"] = buildDir.toString();
|
||||
return fileObject;
|
||||
@@ -269,7 +269,7 @@ QJsonArray clangOptionsForFile(const ProjectFile &file, const ProjectPart &proje
|
||||
? ProjectFile::CHeader : ProjectFile::CXXHeader;
|
||||
}
|
||||
if (usePch == UsePrecompiledHeaders::Yes
|
||||
&& projectPart.precompiledHeaders.contains(file.path)) {
|
||||
&& projectPart.precompiledHeaders.contains(file.path.path())) {
|
||||
usePch = UsePrecompiledHeaders::No;
|
||||
}
|
||||
optionsBuilder.updateFileLanguage(fileKind);
|
||||
|
||||
Reference in New Issue
Block a user