[llvm] [DebugInfo] Make DISubprogram's hashing always produce the same result (PR #90770)
Augusto Noronha via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 11:22:14 PDT 2024
================
@@ -1184,4 +1186,52 @@ TEST(MetadataTest, DbgVariableRecordConversionRoutines) {
UseNewDbgInfoFormat = false;
}
+// Test that the hashing function for DISubprograms produce the same result
+// after replacing the temporary scope.
+TEST(DIBuilder, HashingDISubprogram) {
+ LLVMContext Ctx;
+ std::unique_ptr<Module> M = std::make_unique<Module>("MyModule", Ctx);
+ DIBuilder DIB(*M);
+
+ DIFile *F = DIB.createFile("main.c", "/");
+ DICompileUnit *CU =
+ DIB.createCompileUnit(dwarf::DW_LANG_C, F, "Test", false, "", 0);
+
+ llvm::TempDIType ForwardDeclaredType =
+ llvm::TempDIType(DIB.createReplaceableCompositeType(
+ llvm::dwarf::DW_TAG_structure_type, "MyType", CU, F, 0, 0, 8, 8, {},
+ "UniqueIdentifier"));
+
----------------
augusto2112 wrote:
There's already a comment above the test with an explanation of why we need the type. Do you think I should add some clarification to it?
```
// Test that the hashing function for DISubprograms produce the same result
// after replacing the temporary scope.
```
https://github.com/llvm/llvm-project/pull/90770
More information about the llvm-commits
mailing list