Clang: Handle generated files

We don't handled generated files so we got internal parse errors.

Change-Id: If75e202f93fe3f71f43e3b1d15c0fb77e20c2248
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-02-01 13:43:28 +01:00
parent 55400d5bec
commit b860d46579
23 changed files with 402 additions and 124 deletions

View File

@@ -28,6 +28,8 @@
#include "clangbackendipc_global.h"
#include "filepath.h"
#include <vector>
namespace ClangBackEnd {
namespace V2 {
@@ -104,6 +106,12 @@ public:
&& first.commandLineArguments_ == second.commandLineArguments_;
}
friend bool operator<(const FileContainer &first, const FileContainer &second)
{
return std::tie(first.documentRevision_, first.filePath_, first.unsavedFileContent_, first.commandLineArguments_)
< std::tie(second.documentRevision_, second.filePath_, second.unsavedFileContent_, second.commandLineArguments_);
}
FileContainer clone() const
{
return FileContainer(filePath_.clone(),
@@ -119,9 +127,10 @@ private:
quint32 documentRevision_ = 0;
};
using FileContainers = std::vector<FileContainer>;
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container);
void PrintTo(const FileContainer &container, ::std::ostream* os);
} // namespace V2
} // namespace ClangBackEnd

View File

@@ -77,6 +77,11 @@ public:
return std::move(name_);
}
Utils::PathString path() const
{
return {directory_, "/", name_};
}
friend QDataStream &operator<<(QDataStream &out, const FilePath &filePath)
{
out << filePath.directory_;
@@ -106,6 +111,12 @@ public:
&& first.directory_ == second.directory_;
}
friend bool operator<(const FilePath &first, const FilePath &second)
{
return std::tie(first.name_, first.directory_)
< std::tie(second.name_, second.directory_);
}
FilePath clone() const
{
return FilePath(directory_.clone(), name_.clone());

View File

@@ -38,8 +38,8 @@ public:
ProjectPartContainer() = default;
ProjectPartContainer(Utils::SmallString &&projectPartId,
Utils::SmallStringVector &&arguments,
Utils::SmallStringVector &&headerPaths,
Utils::SmallStringVector &&sourcePaths)
Utils::PathStringVector &&headerPaths,
Utils::PathStringVector &&sourcePaths)
: projectPartId_(std::move(projectPartId)),
arguments_(std::move(arguments)),
headerPaths_(std::move(headerPaths)),
@@ -57,12 +57,12 @@ public:
return arguments_;
}
const Utils::SmallStringVector &sourcePaths() const
const Utils::PathStringVector &sourcePaths() const
{
return sourcePaths_;
}
const Utils::SmallStringVector &headerPaths() const
const Utils::PathStringVector &headerPaths() const
{
return headerPaths_;
}
@@ -112,8 +112,8 @@ public:
private:
Utils::SmallString projectPartId_;
Utils::SmallStringVector arguments_;
Utils::SmallStringVector headerPaths_;
Utils::SmallStringVector sourcePaths_;
Utils::PathStringVector headerPaths_;
Utils::PathStringVector sourcePaths_;
};
using ProjectPartContainers = std::vector<ProjectPartContainer>;

View File

@@ -25,6 +25,7 @@
#pragma once
#include "filecontainerv2.h"
#include "projectpartcontainerv2.h"
namespace ClangBackEnd {
@@ -33,8 +34,10 @@ class UpdatePchProjectPartsMessage
{
public:
UpdatePchProjectPartsMessage() = default;
UpdatePchProjectPartsMessage(V2::ProjectPartContainers &&projectsParts)
: projectsParts_(std::move(projectsParts))
UpdatePchProjectPartsMessage(V2::ProjectPartContainers &&projectsParts,
V2::FileContainers &&generatedFiles)
: projectsParts_(std::move(projectsParts)),
generatedFiles_(std::move(generatedFiles))
{}
const V2::ProjectPartContainers &projectsParts() const
@@ -47,9 +50,20 @@ public:
return std::move(projectsParts_);
}
const V2::FileContainers &generatedFiles() const
{
return generatedFiles_;
}
V2::FileContainers takeGeneratedFiles()
{
return std::move(generatedFiles_);
}
friend QDataStream &operator<<(QDataStream &out, const UpdatePchProjectPartsMessage &message)
{
out << message.projectsParts_;
out << message.generatedFiles_;
return out;
}
@@ -57,6 +71,7 @@ public:
friend QDataStream &operator>>(QDataStream &in, UpdatePchProjectPartsMessage &message)
{
in >> message.projectsParts_;
in >> message.generatedFiles_;
return in;
}
@@ -64,16 +79,19 @@ public:
friend bool operator==(const UpdatePchProjectPartsMessage &first,
const UpdatePchProjectPartsMessage &second)
{
return first.projectsParts_ == second.projectsParts_;
return first.projectsParts_ == second.projectsParts_
&& first.generatedFiles_ == second.generatedFiles_;
}
UpdatePchProjectPartsMessage clone() const
{
return UpdatePchProjectPartsMessage(Utils::clone(projectsParts_));
return UpdatePchProjectPartsMessage(Utils::clone(projectsParts_),
Utils::clone(generatedFiles_));
}
private:
V2::ProjectPartContainers projectsParts_;
V2::FileContainers generatedFiles_;
};
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdatePchProjectPartsMessage &message);