aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2018-08-16 11:15:07 +0200
committerChristian Stenger <christian.stenger@qt.io>2018-08-16 10:43:03 +0000
commit5ddc14257d26cac0b36d208ac2ca0bb524b84417 (patch)
tree1617f8787575bba316896d2d2b4324a6522a25c2
parent0bc721fa046e5ce320c7bc88bf08bb4c37ae8839 (diff)
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>
-rw-r--r--src/libs/clangsupport/generatedfiles.cpp25
-rw-r--r--src/libs/clangsupport/generatedfiles.h3
2 files changed, 17 insertions, 11 deletions
diff --git a/src/libs/clangsupport/generatedfiles.cpp b/src/libs/clangsupport/generatedfiles.cpp
index 554d84d2f4..d5e36987b2 100644
--- a/src/libs/clangsupport/generatedfiles.cpp
+++ b/src/libs/clangsupport/generatedfiles.cpp
@@ -26,8 +26,8 @@
#include "generatedfiles.h"
namespace ClangBackEnd {
-template<class Type>
-void GeneratedFiles::updateInternal(Type &&fileContainers)
+
+void GeneratedFiles::update(V2::FileContainers &&fileContainers)
{
V2::FileContainers unionFileContainers;
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
@@ -46,14 +46,23 @@ void GeneratedFiles::updateInternal(Type &&fileContainers)
m_fileContainers = std::move(unionFileContainers);
}
-void GeneratedFiles::update(V2::FileContainers &&fileContainers)
-{
- updateInternal(std::move(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 {
diff --git a/src/libs/clangsupport/generatedfiles.h b/src/libs/clangsupport/generatedfiles.h
index 1838e7dab4..e20e0ac69c 100644
--- a/src/libs/clangsupport/generatedfiles.h
+++ b/src/libs/clangsupport/generatedfiles.h
@@ -37,9 +37,6 @@ public:
void remove(const FilePaths &filePaths);
const V2::FileContainers &fileContainers() const;
-private:
- template<class Type>
- void updateInternal(Type &&fileContainers);
private:
V2::FileContainers m_fileContainers;