File src/GcovImporter.cpp changed (mode: 100644) (index 4052ebc..2437084) |
30 |
30 |
#include <istream> |
#include <istream> |
31 |
31 |
#include <regex> |
#include <regex> |
32 |
32 |
#include <set> |
#include <set> |
|
33 |
|
#include <sstream> |
33 |
34 |
#include <stdexcept> |
#include <stdexcept> |
34 |
35 |
#include <string> |
#include <string> |
35 |
36 |
#include <tuple> |
#include <tuple> |
|
44 |
45 |
#include "integration.hpp" |
#include "integration.hpp" |
45 |
46 |
|
|
46 |
47 |
namespace fs = boost::filesystem; |
namespace fs = boost::filesystem; |
|
48 |
|
namespace pt = boost::property_tree; |
47 |
49 |
|
|
48 |
50 |
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89961 for information about |
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89961 for information about |
49 |
51 |
// what's wrong with some versions of `gcov` and why binning is needed. |
// what's wrong with some versions of `gcov` and why binning is needed. |
|
... |
... |
void |
324 |
326 |
GcovImporter::parseGcovJsonGz(const std::string &path) |
GcovImporter::parseGcovJsonGz(const std::string &path) |
325 |
327 |
{ |
{ |
326 |
328 |
namespace io = boost::iostreams; |
namespace io = boost::iostreams; |
327 |
|
namespace pt = boost::property_tree; |
|
328 |
329 |
|
|
329 |
330 |
std::ifstream file(path, std::ios_base::in | std::ios_base::binary); |
std::ifstream file(path, std::ios_base::in | std::ios_base::binary); |
330 |
331 |
|
|
|
... |
... |
GcovImporter::parseGcovJsonGz(const std::string &path) |
332 |
333 |
in.push(io::gzip_decompressor()); |
in.push(io::gzip_decompressor()); |
333 |
334 |
in.push(file); |
in.push(file); |
334 |
335 |
|
|
335 |
|
std::basic_istream<char> is(&in); |
|
|
336 |
|
std::istream is(&in); |
|
337 |
|
parseGcovJson(is); |
|
338 |
|
} |
336 |
339 |
|
|
|
340 |
|
void |
|
341 |
|
GcovImporter::parseGcovJson(std::istream &stream) |
|
342 |
|
{ |
337 |
343 |
pt::ptree props; |
pt::ptree props; |
338 |
|
pt::read_json(is, props); |
|
|
344 |
|
pt::read_json(stream, props); |
339 |
345 |
|
|
340 |
346 |
const std::string cwd = props.get<std::string>("current_working_directory"); |
const std::string cwd = props.get<std::string>("current_working_directory"); |
341 |
347 |
|
|
File src/GcovImporter.hpp changed (mode: 100644) (index 7991260..c65e352) |
20 |
20 |
#include <boost/filesystem/path.hpp> |
#include <boost/filesystem/path.hpp> |
21 |
21 |
|
|
22 |
22 |
#include <functional> |
#include <functional> |
|
23 |
|
#include <iosfwd> |
23 |
24 |
#include <set> |
#include <set> |
24 |
25 |
#include <string> |
#include <string> |
25 |
26 |
#include <unordered_map> |
#include <unordered_map> |
|
... |
... |
private: |
136 |
137 |
* @param path Path of the file. |
* @param path Path of the file. |
137 |
138 |
*/ |
*/ |
138 |
139 |
void parseGcovJsonGz(const std::string &path); |
void parseGcovJsonGz(const std::string &path); |
|
140 |
|
/** |
|
141 |
|
* @brief Parses single JSON dictionary produced by `gcov`. |
|
142 |
|
* |
|
143 |
|
* @param stream Stream with JSON data. |
|
144 |
|
*/ |
|
145 |
|
void parseGcovJson(std::istream &stream); |
139 |
146 |
/** |
/** |
140 |
147 |
* @brief Parses single `*.gcov` file. |
* @brief Parses single `*.gcov` file. |
141 |
148 |
* |
* |