#include "src/protozero/filtering/filter_util.h"
#include <algorithm>
#include <deque>
#include <map>
#include <memory>
#include <set>
#include <google/protobuf/compiler/importer.h>
#include "perfetto/base/build_config.h"
#include "perfetto/ext/base/file_utils.h"
#include "perfetto/ext/base/getopt.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/protozero/proto_utils.h"
#include "src/protozero/filtering/filter_bytecode_generator.h"
#include "src/protozero/filtering/filter_bytecode_parser.h"
namespace protozero {
namespace {
class MultiFileErrorCollectorImpl
: public google::protobuf::compiler::MultiFileErrorCollector { … };
MultiFileErrorCollectorImpl::~MultiFileErrorCollectorImpl() = default;
void MultiFileErrorCollectorImpl::AddError(const std::string& filename,
int line,
int column,
const std::string& message) { … }
void MultiFileErrorCollectorImpl::AddWarning(const std::string& filename,
int line,
int column,
const std::string& message) { … }
}
FilterUtil::FilterUtil() = default;
FilterUtil::~FilterUtil() = default;
bool FilterUtil::LoadMessageDefinition(
const std::string& proto_file,
const std::string& root_message,
const std::string& proto_dir_path,
const std::set<std::string>& passthrough_fields,
const std::set<std::string>& string_filter_fields) { … }
FilterUtil::Message* FilterUtil::ParseProtoDescriptor(
const google::protobuf::Descriptor* proto,
DescriptorsByNameMap* descriptors_by_full_name) { … }
void FilterUtil::Dedupe() { … }
void FilterUtil::PrintAsText(std::optional<std::string> filter_bytecode) { … }
std::string FilterUtil::GenerateFilterBytecode() { … }
std::string FilterUtil::LookupField(const std::string& varint_encoded_path) { … }
std::string FilterUtil::LookupField(const uint32_t* field_ids,
size_t num_fields) { … }
}