Refactor ir_from_cc to allow specifying custom headers
This will allow us to express scenarios where there are multiple headers in
multiple targets. This change is motivated by the need to propagate --targets_and_headers into the ASTVisitor.
PiperOrigin-RevId: 409070703
diff --git a/rs_bindings_from_cc/ir.h b/rs_bindings_from_cc/ir.h
index c597698..e94b106 100644
--- a/rs_bindings_from_cc/ir.h
+++ b/rs_bindings_from_cc/ir.h
@@ -41,12 +41,21 @@
nlohmann::json ToJson() const;
+ template <typename H>
+ friend H AbslHashValue(H h, const HeaderName& header_name) {
+ return H::combine(std::move(h), header_name.name_);
+ }
+
private:
// Header pathname in the format suitable for a google3-relative quote
// include.
std::string name_;
};
+inline bool operator==(const HeaderName& lhs, const HeaderName& rhs) {
+ return lhs.IncludePath() == rhs.IncludePath();
+}
+
inline std::ostream& operator<<(std::ostream& o, const HeaderName& h) {
return o << h.ToJson();
}