Remove Func::record_decl_id
It was replaced by MemberFuncMetadata::record_id.
PiperOrigin-RevId: 413870750
diff --git a/rs_bindings_from_cc/ast_visitor.cc b/rs_bindings_from_cc/ast_visitor.cc
index 4a18298..adb6ae8 100644
--- a/rs_bindings_from_cc/ast_visitor.cc
+++ b/rs_bindings_from_cc/ast_visitor.cc
@@ -215,18 +215,11 @@
}
}
- std::optional<DeclId> record_decl_id;
- if (const auto* method_decl =
- llvm::dyn_cast<clang::CXXMethodDecl>(function_decl)) {
- record_decl_id = GenerateDeclId(method_decl->getParent());
- }
-
std::optional<UnqualifiedIdentifier> translated_name =
GetTranslatedName(function_decl);
if (success && translated_name.has_value()) {
ir_.items.push_back(Func{
.name = *translated_name,
- .record_decl_id = record_decl_id,
.owning_target = GetOwningTarget(function_decl),
.doc_comment = GetComment(function_decl),
.mangled_name = GetMangledName(function_decl),
diff --git a/rs_bindings_from_cc/ir.cc b/rs_bindings_from_cc/ir.cc
index 5536d32..eab4917 100644
--- a/rs_bindings_from_cc/ir.cc
+++ b/rs_bindings_from_cc/ir.cc
@@ -137,9 +137,6 @@
} else {
func["name"][SpecialNameToString(std::get<SpecialName>(name))] = nullptr;
}
- if (record_decl_id.has_value()) {
- func["record_decl_id"] = record_decl_id->value();
- }
func["owning_target"] = owning_target.value();
if (doc_comment) {
func["doc_comment"] = *doc_comment;
diff --git a/rs_bindings_from_cc/ir.h b/rs_bindings_from_cc/ir.h
index 00cf287..2adcfc8 100644
--- a/rs_bindings_from_cc/ir.h
+++ b/rs_bindings_from_cc/ir.h
@@ -260,9 +260,6 @@
nlohmann::json ToJson() const;
UnqualifiedIdentifier name;
- // `DeclId` of the Record this function (method) belongs to, nullopt for
- // free-standing functions.
- std::optional<DeclId> record_decl_id = std::nullopt;
Label owning_target;
std::optional<std::string> doc_comment;
std::string mangled_name;
diff --git a/rs_bindings_from_cc/ir.rs b/rs_bindings_from_cc/ir.rs
index cebcc1d..9cf96d3 100644
--- a/rs_bindings_from_cc/ir.rs
+++ b/rs_bindings_from_cc/ir.rs
@@ -173,7 +173,6 @@
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize)]
pub struct Func {
pub name: UnqualifiedIdentifier,
- pub record_decl_id: Option<DeclId>,
pub owning_target: Label,
pub mangled_name: String,
pub doc_comment: Option<String>,
diff --git a/rs_bindings_from_cc/ir_from_cc_test.rs b/rs_bindings_from_cc/ir_from_cc_test.rs
index e14e27b..c0dd145 100644
--- a/rs_bindings_from_cc/ir_from_cc_test.rs
+++ b/rs_bindings_from_cc/ir_from_cc_test.rs
@@ -20,9 +20,6 @@
for (ref mut expected_item, actual_item) in expected.iter_mut().zip(actual.items()) {
// TODO(hlopko): Handle MappedTypes as well.
match (expected_item, actual_item) {
- (Item::Func(ref mut expected_func), Item::Func(actual_func)) => {
- expected_func.record_decl_id = actual_func.record_decl_id;
- }
(Item::Record(ref mut expected_record), Item::Record(actual_record)) => {
expected_record.id = actual_record.id;
}
@@ -39,7 +36,6 @@
"int Add(int a, int b);",
vec![Item::Func(Func {
name: UnqualifiedIdentifier::Identifier(ir_id("Add")),
- record_decl_id: None,
owning_target: "//test:testing_target".into(),
mangled_name: "_Z3Addii".to_string(),
doc_comment: None,
diff --git a/rs_bindings_from_cc/src_code_gen.rs b/rs_bindings_from_cc/src_code_gen.rs
index f069984..2982a75 100644
--- a/rs_bindings_from_cc/src_code_gen.rs
+++ b/rs_bindings_from_cc/src_code_gen.rs
@@ -720,7 +720,6 @@
fn test_simple_function() -> Result<()> {
let ir = make_ir_from_items([Item::Func(Func {
name: UnqualifiedIdentifier::Identifier(ir_id("add")),
- record_decl_id: None,
owning_target: ir::TESTING_TARGET.into(),
mangled_name: "_Z3Addii".to_string(),
doc_comment: None,
@@ -761,7 +760,6 @@
let ir = make_ir_from_parts(
vec![Item::Func(Func {
name: UnqualifiedIdentifier::Identifier(ir_id("add")),
- record_decl_id: None,
owning_target: ir::TESTING_TARGET.into(),
mangled_name: "_Z3Addii".to_string(),
doc_comment: None,
@@ -998,7 +996,6 @@
fn test_ptr_func() -> Result<()> {
let ir = make_ir_from_items([Item::Func(Func {
name: UnqualifiedIdentifier::Identifier(Identifier { identifier: "Deref".to_string() }),
- record_decl_id: None,
owning_target: ir::TESTING_TARGET.into(),
mangled_name: "_Z5DerefPKPi".to_string(),
doc_comment: None,
@@ -1125,7 +1122,6 @@
fn test_doc_comment_func() -> Result<()> {
let ir = make_ir_from_items([Item::Func(Func {
name: UnqualifiedIdentifier::Identifier(ir_id("func")),
- record_decl_id: None,
owning_target: ir::TESTING_TARGET.into(),
mangled_name: "foo".to_string(),
doc_comment: Some("Doc Comment".to_string()),