diff options
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))); |