Add missing fields to ClangDecl::Print (#7949)

This commit is contained in:
Nicholas Bishop authored and GitHub committed 2026-10-15 15:23:17 +00:00
1 parent e39bdb7afa
commit 08b752e888
2 files changed
+18 -10

No files matched your search

@@ -55,15 +55,15 @@ fn G(x: Cpp.X) {
// CHECK:STDOUT: import_ir_inst5: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc50000005}
// CHECK:STDOUT: import_ir_inst6: {ir_id: import_ir(Cpp), clang_source_loc_id: clang_source_loc50000006}
// CHECK:STDOUT: clang_decls:
// CHECK:STDOUT: clang_decl50000000: {key: {decl: "namespace Carbon {\n}"}, inst_id: inst(Package)}
// CHECK:STDOUT: clang_decl50000001: {key: {decl: "<translation unit>"}, inst_id: inst50000011}
// CHECK:STDOUT: clang_decl50000002: {key: {decl: "struct X {}"}, inst_id: inst50000013}
// CHECK:STDOUT: clang_decl50000003: {key: {decl: "X * _Nonnull p"}, inst_id: inst50000024}
// CHECK:STDOUT: clang_decl50000004: {key: {decl: "void f(X x = {})", clang_decl_signature_id: clang_decl_signature50000000}, inst_id: inst5000002F}
// CHECK:STDOUT: clang_decl50000005: {key: {decl: "inline void f__carbon_thunk()", clang_decl_signature_id: clang_decl_signature50000000}, inst_id: inst50000032}
// CHECK:STDOUT: clang_decl50000006: {key: {decl: "void f(X x = {})", clang_decl_signature_id: clang_decl_signature50000001}, inst_id: inst5000003D}
// CHECK:STDOUT: clang_decl50000007: {key: {decl: "inline void f__carbon_thunk(X * _Nonnull x)", clang_decl_signature_id: clang_decl_signature50000001}, inst_id: inst50000047}
// CHECK:STDOUT: clang_decl50000008: {key: {decl: "X * _Nonnull global"}, inst_id: inst50000052}
// CHECK:STDOUT: clang_decl50000000: {key: {decl: "namespace Carbon {\n}"}, inst_id: inst(Package), is_imported: false}
// CHECK:STDOUT: clang_decl50000001: {key: {decl: "<translation unit>"}, inst_id: inst50000011, is_imported: true}
// CHECK:STDOUT: clang_decl50000002: {key: {decl: "struct X {}"}, inst_id: inst50000013, is_imported: true}
// CHECK:STDOUT: clang_decl50000003: {key: {decl: "X * _Nonnull p"}, inst_id: inst50000024, is_imported: true}
// CHECK:STDOUT: clang_decl50000004: {key: {decl: "void f(X x = {})", clang_decl_signature_id: clang_decl_signature50000000}, inst_id: inst5000002F, is_imported: true}
// CHECK:STDOUT: clang_decl50000005: {key: {decl: "inline void f__carbon_thunk()", clang_decl_signature_id: clang_decl_signature50000000}, inst_id: inst50000032, is_imported: true}
// CHECK:STDOUT: clang_decl50000006: {key: {decl: "void f(X x = {})", clang_decl_signature_id: clang_decl_signature50000001}, inst_id: inst5000003D, is_imported: true}
// CHECK:STDOUT: clang_decl50000007: {key: {decl: "inline void f__carbon_thunk(X * _Nonnull x)", clang_decl_signature_id: clang_decl_signature50000001}, inst_id: inst50000047, is_imported: true}
// CHECK:STDOUT: clang_decl50000008: {key: {decl: "X * _Nonnull global"}, inst_id: inst50000052, var_storage_inst_id: inst50000054, is_imported: true}
// CHECK:STDOUT: clang_decl_signatures:
// CHECK:STDOUT: clang_decl_signature50000000: {kind: normal, num_params: 0}
// CHECK:STDOUT: clang_decl_signature50000001: {kind: normal, num_params: 1, modes: [value]}
+9 -1
View File
@@ -91,7 +91,15 @@ auto ClangDeclKey::Print(llvm::raw_ostream& out) const -> void {
}
auto ClangDecl::Print(llvm::raw_ostream& out) const -> void {
out << "{key: " << key << ", inst_id: " << inst_id << "}";
out << "{key: " << key << ", inst_id: " << inst_id;
if (specific_id.has_value()) {
out << ", specific_id: " << specific_id;
}
if (var_storage_inst_id.has_value()) {
out << ", var_storage_inst_id: " << var_storage_inst_id;
}
out << ", is_imported: " << (is_imported ? "true" : "false");
out << "}";
}
class ClangDeclStore::KeyContext : public TranslatingKeyContext<KeyContext> {