forked from qt-creator/qt-creator
Clang: Compile fix for older clang
This patch is needed due to some issues of an older STL implementation. The patch can safely be reverted when Xcode 8 is marked as outdated. Change-Id: I0f66eb6f3a0ae71f0da3f5678d9b4d47cdf146bf Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -26,8 +26,8 @@
|
|||||||
#include "generatedfiles.h"
|
#include "generatedfiles.h"
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
template<class Type>
|
|
||||||
void GeneratedFiles::updateInternal(Type &&fileContainers)
|
void GeneratedFiles::update(V2::FileContainers &&fileContainers)
|
||||||
{
|
{
|
||||||
V2::FileContainers unionFileContainers;
|
V2::FileContainers unionFileContainers;
|
||||||
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
|
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
|
||||||
@@ -46,14 +46,23 @@ void GeneratedFiles::updateInternal(Type &&fileContainers)
|
|||||||
m_fileContainers = std::move(unionFileContainers);
|
m_fileContainers = std::move(unionFileContainers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratedFiles::update(V2::FileContainers &&fileContainers)
|
|
||||||
{
|
|
||||||
updateInternal(std::move(fileContainers));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneratedFiles::update(const V2::FileContainers &fileContainers)
|
void GeneratedFiles::update(const V2::FileContainers &fileContainers)
|
||||||
{
|
{
|
||||||
updateInternal(fileContainers);
|
V2::FileContainers unionFileContainers;
|
||||||
|
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
|
||||||
|
|
||||||
|
auto compare = [] (const V2::FileContainer &first, const V2::FileContainer &second) {
|
||||||
|
return first.filePath < second.filePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::set_union(fileContainers.begin(),
|
||||||
|
fileContainers.end(),
|
||||||
|
std::make_move_iterator(m_fileContainers.begin()),
|
||||||
|
std::make_move_iterator(m_fileContainers.end()),
|
||||||
|
std::back_inserter(unionFileContainers),
|
||||||
|
compare);
|
||||||
|
|
||||||
|
m_fileContainers = std::move(unionFileContainers);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Compare {
|
class Compare {
|
||||||
|
@@ -37,9 +37,6 @@ public:
|
|||||||
void remove(const FilePaths &filePaths);
|
void remove(const FilePaths &filePaths);
|
||||||
|
|
||||||
const V2::FileContainers &fileContainers() const;
|
const V2::FileContainers &fileContainers() const;
|
||||||
private:
|
|
||||||
template<class Type>
|
|
||||||
void updateInternal(Type &&fileContainers);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
V2::FileContainers m_fileContainers;
|
V2::FileContainers m_fileContainers;
|
||||||
|
Reference in New Issue
Block a user