| File src/GcovImporter.cpp changed (mode: 100644) (index cc903ca..0fae288) |
| 34 |
34 |
#include <stdexcept> |
#include <stdexcept> |
| 35 |
35 |
#include <string> |
#include <string> |
| 36 |
36 |
#include <tuple> |
#include <tuple> |
|
37 |
|
#include <type_traits> |
| 37 |
38 |
#include <unordered_set> |
#include <unordered_set> |
| 38 |
39 |
#include <utility> |
#include <utility> |
| 39 |
40 |
#include <vector> |
#include <vector> |
| |
| ... |
... |
namespace { |
| 111 |
112 |
//! Files of this bin. |
//! Files of this bin. |
| 112 |
113 |
std::vector<std::string> paths; |
std::vector<std::string> paths; |
| 113 |
114 |
}; |
}; |
|
115 |
|
|
|
116 |
|
// |
|
117 |
|
// Work around Boost renaming no_push() to disable_recursion_pending() and |
|
118 |
|
// eventually dropping the former by providing a wrapper that prefers the |
|
119 |
|
// latter. |
|
120 |
|
// |
|
121 |
|
|
|
122 |
|
template <typename T> |
|
123 |
|
constexpr decltype(std::declval<T>().disable_recursion_pending(), bool()) |
|
124 |
|
useNoPush(int) |
|
125 |
|
{ return false; } |
|
126 |
|
|
|
127 |
|
template <typename T> |
|
128 |
|
constexpr bool useNoPush(long) |
|
129 |
|
{ return true; } |
|
130 |
|
|
|
131 |
|
template <typename DT = fs::recursive_directory_iterator> |
|
132 |
|
typename std::enable_if<useNoPush<DT>(0)>::type stop_recursion(DT &it) |
|
133 |
|
{ |
|
134 |
|
it.no_push(); |
|
135 |
|
} |
|
136 |
|
|
|
137 |
|
template <typename DT = fs::recursive_directory_iterator> |
|
138 |
|
typename std::enable_if<!useNoPush<DT>(0)>::type stop_recursion(DT &it) |
|
139 |
|
{ |
|
140 |
|
it.disable_recursion_pending(); |
|
141 |
|
} |
| 114 |
142 |
} |
} |
| 115 |
143 |
|
|
| 116 |
144 |
GcovInfo::GcovInfo() |
GcovInfo::GcovInfo() |
| |
| ... |
... |
GcovImporter::GcovImporter(const std::string &root, |
| 195 |
223 |
fs::path path = it->path(); |
fs::path path = it->path(); |
| 196 |
224 |
if (fs::is_directory(path)) { |
if (fs::is_directory(path)) { |
| 197 |
225 |
if (skipDirs.count(path.filename().string())) { |
if (skipDirs.count(path.filename().string())) { |
| 198 |
|
it.no_push(); |
|
|
226 |
|
stop_recursion(it); |
| 199 |
227 |
continue; |
continue; |
| 200 |
228 |
} |
} |
| 201 |
229 |
} else if (fs::is_regular_file(path)) { |
} else if (fs::is_regular_file(path)) { |
| |
| ... |
... |
GcovImporter::GcovImporter(const std::string &root, |
| 214 |
242 |
fs::path path = it->path(); |
fs::path path = it->path(); |
| 215 |
243 |
if (fs::is_directory(path)) { |
if (fs::is_directory(path)) { |
| 216 |
244 |
if (skipDirs.count(path.filename().string())) { |
if (skipDirs.count(path.filename().string())) { |
| 217 |
|
it.no_push(); |
|
|
245 |
|
stop_recursion(it); |
| 218 |
246 |
} else if (skipPaths.count(normalizePath(fs::absolute(path)))) { |
} else if (skipPaths.count(normalizePath(fs::absolute(path)))) { |
| 219 |
|
it.no_push(); |
|
|
247 |
|
stop_recursion(it); |
| 220 |
248 |
} |
} |
| 221 |
249 |
} else if (extensions.count(path.extension().string())) { |
} else if (extensions.count(path.extension().string())) { |
| 222 |
250 |
std::string filePath = makeRelativePath(rootDir, path).string(); |
std::string filePath = makeRelativePath(rootDir, path).string(); |