[llvm] cef167f - [DebugInfo][unittest] Fix heap-use-after-free after D76115
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 23:31:18 PDT 2021
Author: Fangrui Song
Date: 2021-03-29T23:31:14-07:00
New Revision: cef167f8d467201ec40a7817397c18fc264d0b54
URL: https://github.com/llvm/llvm-project/commit/cef167f8d467201ec40a7817397c18fc264d0b54
DIFF: https://github.com/llvm/llvm-project/commit/cef167f8d467201ec40a7817397c18fc264d0b54.diff
LOG: [DebugInfo][unittest] Fix heap-use-after-free after D76115
Added:
Modified:
llvm/unittests/IR/DebugInfoTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index d3e025a6edce..060a5c2b08bc 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -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", "/");
More information about the llvm-commits
mailing list