[llvm-branch-commits] [llvm] d968073 - [IR] Fix DIGlobalVariable unit test
Bryan Chan via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 24 08:41:03 PDT 2020
Author: Bryan Chan
Date: 2020-06-23T11:27:10-04:00
New Revision: d9680739465b531d1716be4d136cb39f1b0c064d
URL: https://github.com/llvm/llvm-project/commit/d9680739465b531d1716be4d136cb39f1b0c064d
DIFF: https://github.com/llvm/llvm-project/commit/d9680739465b531d1716be4d136cb39f1b0c064d.diff
LOG: [IR] Fix DIGlobalVariable unit test
...broken by http://github.com/flang-compiler/llvm/commit/edfad65eebdf045b.
Added:
Modified:
llvm/unittests/IR/MetadataTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 927d8069c77a..21951b8c970f 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -2142,11 +2142,13 @@ TEST_F(DIGlobalVariableTest, get) {
DIDerivedType *StaticDataMemberDeclaration =
cast<DIDerivedType>(getDerivedType());
+ DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
uint32_t AlignInBits = 8;
auto *N = DIGlobalVariable::get(
Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
- IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
+ IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
+ AlignInBits);
EXPECT_EQ(dwarf::DW_TAG_variable, N->getTag());
EXPECT_EQ(Scope, N->getScope());
@@ -2159,56 +2161,65 @@ TEST_F(DIGlobalVariableTest, get) {
EXPECT_EQ(IsDefinition, N->isDefinition());
EXPECT_EQ(StaticDataMemberDeclaration, N->getStaticDataMemberDeclaration());
EXPECT_EQ(templateParams, N->getTemplateParams());
+ EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(AlignInBits, N->getAlignInBits());
EXPECT_EQ(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(
Context, getSubprogram(), Name, LinkageName, File, Line,
Type, IsLocalToUnit, IsDefinition,
- StaticDataMemberDeclaration, templateParams, AlignInBits));
+ StaticDataMemberDeclaration, templateParams, Flags,
+ AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, "other", LinkageName, File,
Line, Type, IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, "other", File, Line,
Type, IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName,
getFile(), Line, Type, IsLocalToUnit,
IsDefinition, StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line + 1, Type, IsLocalToUnit,
IsDefinition, StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, getDerivedType(), IsLocalToUnit,
IsDefinition, StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, !IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, IsLocalToUnit, !IsDefinition,
StaticDataMemberDeclaration,
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, IsLocalToUnit, IsDefinition,
cast<DIDerivedType>(getDerivedType()),
- templateParams, AlignInBits));
+ templateParams, Flags, AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration, nullptr,
+ Flags, AlignInBits));
+ EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
+ Line, Type, IsLocalToUnit, IsDefinition,
+ StaticDataMemberDeclaration,
+ templateParams,
+ static_cast<DINode::DIFlags>(Flags + 1),
AlignInBits));
EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
Line, Type, IsLocalToUnit, IsDefinition,
StaticDataMemberDeclaration,
- templateParams, (AlignInBits << 1)));
+ templateParams, Flags,
+ (AlignInBits << 1)));
TempDIGlobalVariable Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
@@ -2230,14 +2241,17 @@ TEST_F(DIGlobalVariableExpressionTest, get) {
auto *Expr2 = DIExpression::get(Context, {1, 2, 3});
DIDerivedType *StaticDataMemberDeclaration =
cast<DIDerivedType>(getDerivedType());
+ DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
uint32_t AlignInBits = 8;
auto *Var = DIGlobalVariable::get(
Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
- IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
+ IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
+ AlignInBits);
auto *Var2 = DIGlobalVariable::get(
Context, Scope, "other", LinkageName, File, Line, Type, IsLocalToUnit,
- IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
+ IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
+ AlignInBits);
auto *N = DIGlobalVariableExpression::get(Context, Var, Expr);
EXPECT_EQ(Var, N->getVariable());
More information about the llvm-branch-commits
mailing list