diff options
author | Chih-Ping Chen <chih-ping.chen@intel.com> | 2022-04-06 08:22:49 -0400 |
---|---|---|
committer | Chih-Ping Chen <chih-ping.chen@intel.com> | 2022-04-15 16:38:23 -0400 |
commit | eab6e94f912d014e6f19e1737ef81e36e4601faf (patch) | |
tree | ac3aaa61d4613284e68fb869e3bc07e3f92a117b /llvm/unittests/IR/MetadataTest.cpp | |
parent | 39a68cc016ec3ef51091c1469b80c6733a9b7c5f (diff) | |
download | llvm-eab6e94f912d014e6f19e1737ef81e36e4601faf.zip llvm-eab6e94f912d014e6f19e1737ef81e36e4601faf.tar.gz llvm-eab6e94f912d014e6f19e1737ef81e36e4601faf.tar.bz2 |
[DebugInfo] Add a TargetFuncName field in DISubprogram for
specifying DW_AT_trampoline as a string. Also update the signature
of DIBuilder::createFunction to reflect this addition.
Differential Revision: https://reviews.llvm.org/D123697
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r-- | llvm/unittests/IR/MetadataTest.cpp | 69 |
1 files changed, 49 insertions, 20 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index f870ec8..4297e32 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -2283,6 +2283,8 @@ TEST_F(DISubprogramTest, get) { DISubprogram *Declaration = getSubprogram(); MDTuple *RetainedNodes = getTuple(); MDTuple *ThrownTypes = getTuple(); + MDTuple *Annotations = getTuple(); + StringRef TargetFuncName = "target"; DICompileUnit *Unit = getUnit(); DISubprogram::DISPFlags SPFlags = static_cast<DISubprogram::DISPFlags>(Virtuality); @@ -2293,7 +2295,8 @@ TEST_F(DISubprogramTest, get) { auto *N = DISubprogram::get( Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, - TemplateParams, Declaration, RetainedNodes, ThrownTypes); + TemplateParams, Declaration, RetainedNodes, ThrownTypes, Annotations, + TargetFuncName); EXPECT_EQ(dwarf::DW_TAG_subprogram, N->getTag()); EXPECT_EQ(Scope, N->getScope()); @@ -2316,101 +2319,127 @@ TEST_F(DISubprogramTest, get) { EXPECT_EQ(Declaration, N->getDeclaration()); EXPECT_EQ(RetainedNodes, N->getRetainedNodes().get()); EXPECT_EQ(ThrownTypes, N->getThrownTypes().get()); + EXPECT_EQ(Annotations, N->getAnnotations().get()); + EXPECT_EQ(TargetFuncName, N->getTargetFuncName()); EXPECT_EQ(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, RetainedNodes, - ThrownTypes)); + ThrownTypes, Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, getCompositeType(), Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, "other", LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, "other", File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, RetainedNodes, - ThrownTypes)); + ThrownTypes, Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, getFile(), Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line + 1, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, getSubroutineType(), ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get( Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags ^ DISubprogram::SPFlagLocalToUnit, Unit, - TemplateParams, Declaration, RetainedNodes, ThrownTypes)); + TemplateParams, Declaration, RetainedNodes, ThrownTypes, + Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get( Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags ^ DISubprogram::SPFlagDefinition, Unit, - TemplateParams, Declaration, RetainedNodes, ThrownTypes)); + TemplateParams, Declaration, RetainedNodes, ThrownTypes, + Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine + 1, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, getCompositeType(), VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get( Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags ^ DISubprogram::SPFlagVirtual, Unit, - TemplateParams, Declaration, RetainedNodes, ThrownTypes)); + TemplateParams, Declaration, RetainedNodes, ThrownTypes, + Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex + 1, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, - RetainedNodes, ThrownTypes)); + RetainedNodes, ThrownTypes, Annotations, + TargetFuncName)); EXPECT_NE(N, DISubprogram::get( Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags ^ DISubprogram::SPFlagOptimized, Unit, - TemplateParams, Declaration, RetainedNodes, ThrownTypes)); + TemplateParams, Declaration, RetainedNodes, ThrownTypes, + Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, nullptr, TemplateParams, Declaration, RetainedNodes, - ThrownTypes)); + ThrownTypes, Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, getTuple(), - Declaration, RetainedNodes, ThrownTypes)); + Declaration, RetainedNodes, ThrownTypes, + Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, getSubprogram(), RetainedNodes, - ThrownTypes)); + ThrownTypes, Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, - TemplateParams, Declaration, getTuple())); + TemplateParams, Declaration, getTuple(), + ThrownTypes, Annotations, TargetFuncName)); EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, RetainedNodes, - getTuple())); + getTuple(), Annotations, TargetFuncName)); + EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, + Type, ScopeLine, ContainingType, VirtualIndex, + ThisAdjustment, Flags, SPFlags, Unit, + TemplateParams, Declaration, RetainedNodes, + ThrownTypes, getTuple(), TargetFuncName)); + EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line, + Type, ScopeLine, ContainingType, VirtualIndex, + ThisAdjustment, Flags, SPFlags, Unit, + TemplateParams, Declaration, RetainedNodes, + ThrownTypes, Annotations, "other")); TempDISubprogram Temp = N->clone(); EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp))); |