1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[DebugInfo][unittest] Fix heap-use-after-free after D76115

This commit is contained in:
Fangrui Song 2021-03-29 23:31:14 -07:00
parent 9f0e36e773
commit 708a8d54ef

View File

@ -230,18 +230,13 @@ TEST(DIBuilder, CreateFortranArrayTypeWithAttributes) {
DIVariable::deleteTemporary(DataLocation);
}
DISubprogram *getSubprogram() {
LLVMContext Context;
return DISubprogram::getDistinct(Context, nullptr, "", "", nullptr, 0,
nullptr, 0, nullptr, 0, 0, DINode::FlagZero,
DISubprogram::SPFlagZero, nullptr);
}
TEST(DIBuilder, CreateSetType) {
LLVMContext Ctx;
std::unique_ptr<Module> M(new Module("MyModule", Ctx));
DIBuilder DIB(*M);
DIScope *Scope = getSubprogram();
DIScope *Scope = DISubprogram::getDistinct(
Ctx, nullptr, "", "", nullptr, 0, nullptr, 0, nullptr, 0, 0,
DINode::FlagZero, DISubprogram::SPFlagZero, nullptr);
DIType *Type = DIB.createBasicType("Int", 64, dwarf::DW_ATE_signed);
DIFile *F = DIB.createFile("main.c", "/");