It's now a macro instead of a class template. Fixes compilation on latest abseil.
diff --git a/differ.cc b/differ.cc
index 9aaff28b..6254c581 100644
--- a/differ.cc
+++ b/differ.cc
@@ -50,7 +50,7 @@ using ::security::binexport::FormatAddress;
// Return the immediate children of the call graph node denoted by
// address. Skip nodes that have already been matched.
void GetUnmatchedChildren(const CallGraph& call_graph, CallGraph::Vertex vertex,
- absl::Nonnull<FlowGraphs*> children) {
+ FlowGraphs* absl_nonnull children) {
for (auto [edge_it, edge_end] =
boost::out_edges(vertex, call_graph.GetGraph());
edge_it != edge_end; ++edge_it) {
@@ -73,7 +73,7 @@ void GetUnmatchedChildren(const CallGraph& call_graph, CallGraph::Vertex vertex,
// Returns the immediate parents of the call graph node denoted by address.
// Skips nodes that have already been matched.
void GetUnmatchedParents(const CallGraph& call_graph, CallGraph::Vertex vertex,
- absl::Nonnull<FlowGraphs*> parents) {
+ FlowGraphs* absl_nonnull parents) {
for (auto [edge_it, edge_end] =
boost::in_edges(vertex, call_graph.GetGraph());
edge_it != edge_end; ++edge_it) {
@@ -96,8 +96,8 @@ void GetUnmatchedParents(const CallGraph& call_graph, CallGraph::Vertex vertex,
// Adds empty flow graphs to all call graph vertices that don't already have one
// attached (for example for DLL stub functions). Returns an error if a flow
// graph already exists for a call graph vertex.
-absl::Status AddSubsToCallGraph(absl::Nonnull<CallGraph*> call_graph,
- absl::Nonnull<FlowGraphs*> flow_graphs) {
+absl::Status AddSubsToCallGraph(CallGraph* absl_nonnull call_graph,
+ FlowGraphs* absl_nonnull flow_graphs) {
for (auto [it, end] = boost::vertices(call_graph->GetGraph()); it != end;
++it) {
const CallGraph::Vertex vertex = *it;
@@ -120,10 +120,10 @@ absl::Status AddSubsToCallGraph(absl::Nonnull<CallGraph*> call_graph,
absl::Status SetupGraphsFromProto(
const BinExport2& proto, const std::string& filename,
- absl::Nonnull<CallGraph*> call_graph,
- absl::Nonnull<FlowGraphs*> flow_graphs,
- absl::Nullable<FlowGraphInfos*> flow_graph_infos,
- absl::Nonnull<Instruction::Cache*> instruction_cache) {
+ CallGraph* absl_nonnull call_graph,
+ FlowGraphs* absl_nonnull flow_graphs,
+ FlowGraphInfos* absl_nullable flow_graph_infos,
+ Instruction::Cache* absl_nonnull instruction_cache) {
NA_RETURN_IF_ERROR(call_graph->Read(proto, filename));
for (const auto& proto_flow_graph : proto.flow_graph()) {
if (proto_flow_graph.basic_block_index_size() == 0) {
@@ -156,10 +156,10 @@ absl::Status SetupGraphsFromProto(
}
absl::Status Read(const std::string& filename,
- absl::Nonnull<CallGraph*> call_graph,
- absl::Nonnull<FlowGraphs*> flow_graphs,
- absl::Nullable<FlowGraphInfos*> flow_graph_infos,
- absl::Nonnull<Instruction::Cache*> instruction_cache) {
+ CallGraph* absl_nonnull call_graph,
+ FlowGraphs* absl_nonnull flow_graphs,
+ FlowGraphInfos* absl_nullable flow_graph_infos,
+ Instruction::Cache* absl_nonnull instruction_cache) {
call_graph->Reset();
DeleteFlowGraphs(flow_graphs);
if (flow_graph_infos) {
@@ -183,7 +183,7 @@ absl::Status Read(const std::string& filename,
flow_graph_infos, instruction_cache);
}
-void DeleteFlowGraphs(absl::Nullable<FlowGraphs*> flow_graphs) {
+void DeleteFlowGraphs(FlowGraphs* absl_nullable flow_graphs) {
if (!flow_graphs) {
return;
}
@@ -195,9 +195,9 @@ void DeleteFlowGraphs(absl::Nullable<FlowGraphs*> flow_graphs) {
}
ScopedCleanup::ScopedCleanup(
- absl::Nullable<FlowGraphs*> flow_graphs1,
- absl::Nullable<FlowGraphs*> flow_graphs2,
- absl::Nullable<Instruction::Cache*> instruction_cache)
+ FlowGraphs* absl_nullable flow_graphs1,
+ FlowGraphs* absl_nullable flow_graphs2,
+ Instruction::Cache* absl_nullable instruction_cache)
: flow_graphs1_(flow_graphs1),
flow_graphs2_(flow_graphs2),
instruction_cache_(instruction_cache) {}
@@ -210,13 +210,13 @@ ScopedCleanup::~ScopedCleanup() {
}
}
-void ResetMatches(absl::Nonnull<FlowGraphs*> flow_graphs) {
+void ResetMatches(FlowGraphs* absl_nonnull flow_graphs) {
for (auto* flow_graph : *flow_graphs) {
flow_graph->ResetMatches();
}
}
-void Diff(absl::Nonnull<MatchingContext*> context,
+void Diff(MatchingContext* absl_nonnull context,
const MatchingSteps& call_graph_steps,
const MatchingStepsFlowGraph& basic_block_steps) {
// The outer loop controls the rigorousness for initial matching while the
@@ -289,13 +289,13 @@ void Diff(absl::Nonnull<MatchingContext*> context,
ClassifyChanges(context);
}
-void Count(const FlowGraph& flow_graph, absl::Nonnull<Counts*> counts) {
+void Count(const FlowGraph& flow_graph, Counts* absl_nonnull counts) {
FlowGraphs flow_graphs;
CHECK(flow_graphs.insert(&const_cast<FlowGraph&>(flow_graph)).second);
Count(flow_graphs, counts);
}
-void Count(const FlowGraphs& flow_graphs, absl::Nonnull<Counts*> counts) {
+void Count(const FlowGraphs& flow_graphs, Counts* absl_nonnull counts) {
uint64_t num_functions = 0;
uint64_t num_basic_blocks = 0;
uint64_t num_instructions = 0;
@@ -413,8 +413,8 @@ double GetConfidence(const Histogram& histogram, Confidences* confidences) {
void GetCountsAndHistogram(const FlowGraphs& flow_graphs1,
const FlowGraphs& flow_graphs2,
const FixedPoints& fixed_points,
- absl::Nonnull<Histogram*> histogram,
- absl::Nonnull<Counts*> counts) {
+ Histogram* absl_nonnull histogram,
+ Counts* absl_nonnull counts) {
Counts counts1;
Counts counts2;
Count(flow_graphs1, &counts1);
diff --git a/differ.h b/differ.h
index 2e228348..236a76d8 100644
--- a/differ.h
+++ b/differ.h
@@ -39,15 +39,15 @@ using Confidences = absl::btree_map<std::string, double>;
// Main entry point to the differ, runs the core algorithm and produces a
// (partial) matching between the two inputs.
-void Diff(absl::Nonnull<MatchingContext*> context,
+void Diff(MatchingContext* absl_nonnull context,
const MatchingSteps& call_graph_steps,
const MatchingStepsFlowGraph& basic_block_steps);
class ScopedCleanup {
public:
- ScopedCleanup(absl::Nullable<FlowGraphs*> flow_graphs1,
- absl::Nullable<FlowGraphs*> flow_graphs2,
- absl::Nullable<Instruction::Cache*> instruction_cache);
+ ScopedCleanup(FlowGraphs* absl_nullable flow_graphs1,
+ FlowGraphs* absl_nullable flow_graphs2,
+ Instruction::Cache* absl_nullable instruction_cache);
~ScopedCleanup();
private:
@@ -56,18 +56,18 @@ class ScopedCleanup {
Instruction::Cache* instruction_cache_;
};
-void DeleteFlowGraphs(absl::Nullable<FlowGraphs*> flow_graphs);
+void DeleteFlowGraphs(FlowGraphs* absl_nullable flow_graphs);
// Removes all fixed point assignments from flow graphs so they can be used
// again for a different comparison.
-void ResetMatches(absl::Nonnull<FlowGraphs*> flow_graphs);
+void ResetMatches(FlowGraphs* absl_nonnull flow_graphs);
// Loads a .BinExport file into the internal data structures.
absl::Status Read(const std::string& filename,
- absl::Nonnull<CallGraph*> call_graph,
- absl::Nonnull<FlowGraphs*> flow_graphs,
- absl::Nullable<FlowGraphInfos*> flow_graph_infos,
- absl::Nonnull<Instruction::Cache*> instruction_cache);
+ CallGraph* absl_nonnull call_graph,
+ FlowGraphs* absl_nonnull flow_graphs,
+ FlowGraphInfos* absl_nullable flow_graph_infos,
+ Instruction::Cache* absl_nonnull instruction_cache);
// Gets the similarity score for two full binaries.
double GetSimilarityScore(const CallGraph& call_graph1,
@@ -86,14 +86,14 @@ double GetConfidence(const Histogram& histogram, Confidences* confidences);
void GetCountsAndHistogram(const FlowGraphs& flow_graphs1,
const FlowGraphs& flow_graphs2,
const FixedPoints& fixed_points,
- absl::Nonnull<Histogram*> histogram,
- absl::Nonnull<Counts*> counts);
+ Histogram* absl_nonnull histogram,
+ Counts* absl_nonnull counts);
// Collects various statistics (no of instructions/edges/basic blocks).
-void Count(const FlowGraphs& flow_graphs, absl::Nonnull<Counts*> counts);
-void Count(const FlowGraph& flow_graph, absl::Nonnull<Counts*> counts);
-void Count(const FixedPoint& fixed_point, absl::Nonnull<Counts*> counts,
- absl::Nonnull<Histogram*> histogram);
+void Count(const FlowGraphs& flow_graphs, Counts* absl_nonnull counts);
+void Count(const FlowGraph& flow_graph, Counts* absl_nonnull counts);
+void Count(const FixedPoint& fixed_point, Counts* absl_nonnull counts,
+ Histogram* absl_nonnull histogram);
} // namespace security::bindiff
It's now a macro instead of a class template. Fixes compilation on latest abseil.