diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-07-31 18:58:39 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-07-31 18:58:39 +0000 |
commit | ed013cd221aea3911dc0c8f33948c05799f751c0 (patch) | |
tree | a164aebf28e64bfda6398d88c50d41ce4acf9ed3 /llvm/unittests/IR/MetadataTest.cpp | |
parent | 0aeed7c0b864f51e64a006a1a17172bfaab8998c (diff) | |
download | llvm-ed013cd221aea3911dc0c8f33948c05799f751c0.zip llvm-ed013cd221aea3911dc0c8f33948c05799f751c0.tar.gz llvm-ed013cd221aea3911dc0c8f33948c05799f751c0.tar.bz2 |
DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags,
using `DW_TAG_variable` in their place Stop exposing the `tag:` field at
all in the assembly format for `DILocalVariable`.
Most of the testcase updates were generated by the following sed script:
find test/ -name "*.ll" -o -name "*.mir" |
xargs grep -l 'DILocalVariable' |
xargs sed -i '' \
-e 's/tag: DW_TAG_arg_variable, //' \
-e 's/tag: DW_TAG_auto_variable, //'
There were only a handful of tests in `test/Assembly` that I needed to
update by hand.
(Note: a follow-up could change `DILocalVariable::DILocalVariable()` to
set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable`
(as appropriate), instead of having that logic magically in the backend
in `DbgVariable`. I've added a FIXME to that effect.)
llvm-svn: 243774
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r-- | llvm/unittests/IR/MetadataTest.cpp | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 260ce85..0b068ed 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -1861,7 +1861,6 @@ TEST_F(DIGlobalVariableTest, get) { typedef MetadataTest DILocalVariableTest; TEST_F(DILocalVariableTest, get) { - unsigned Tag = dwarf::DW_TAG_arg_variable; DILocalScope *Scope = getSubprogram(); StringRef Name = "name"; DIFile *File = getFile(); @@ -1870,9 +1869,9 @@ TEST_F(DILocalVariableTest, get) { unsigned Arg = 6; unsigned Flags = 7; - auto *N = DILocalVariable::get(Context, Tag, Scope, Name, File, Line, Type, - Arg, Flags); - EXPECT_EQ(Tag, N->getTag()); + auto *N = + DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags); + EXPECT_TRUE(N->isParameter()); EXPECT_EQ(Scope, N->getScope()); EXPECT_EQ(Name, N->getName()); EXPECT_EQ(File, N->getFile()); @@ -1880,47 +1879,44 @@ TEST_F(DILocalVariableTest, get) { EXPECT_EQ(Type, N->getType()); EXPECT_EQ(Arg, N->getArg()); EXPECT_EQ(Flags, N->getFlags()); - EXPECT_EQ(N, DILocalVariable::get(Context, Tag, Scope, Name, File, Line, Type, - Arg, Flags)); + EXPECT_EQ(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, + Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, dwarf::DW_TAG_auto_variable, Scope, - Name, File, Line, Type, Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, getSubprogram(), Name, File, - Line, Type, Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, "other", File, Line, - Type, Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, Name, getFile(), Line, + EXPECT_FALSE( + DILocalVariable::get(Context, Scope, Name, File, Line, Type, 0, Flags) + ->isParameter()); + EXPECT_NE(N, DILocalVariable::get(Context, getSubprogram(), Name, File, Line, Type, Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, Name, File, Line + 1, - Type, Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, Name, File, Line, + EXPECT_NE(N, DILocalVariable::get(Context, Scope, "other", File, Line, Type, + Arg, Flags)); + EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, getFile(), Line, Type, + Arg, Flags)); + EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line + 1, Type, + Arg, Flags)); + EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, getDerivedType(), Arg, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, Name, File, Line, Type, + EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg + 1, Flags)); - EXPECT_NE(N, DILocalVariable::get(Context, Tag, Scope, Name, File, Line, Type, - Arg, ~Flags)); + EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, + ~Flags)); TempDILocalVariable Temp = N->clone(); EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp))); } TEST_F(DILocalVariableTest, getArg256) { - EXPECT_EQ(255u, DILocalVariable::get(Context, dwarf::DW_TAG_arg_variable, - getSubprogram(), "", getFile(), 0, - nullptr, 255, 0) + EXPECT_EQ(255u, DILocalVariable::get(Context, getSubprogram(), "", getFile(), + 0, nullptr, 255, 0) ->getArg()); - EXPECT_EQ(256u, DILocalVariable::get(Context, dwarf::DW_TAG_arg_variable, - getSubprogram(), "", getFile(), 0, - nullptr, 256, 0) + EXPECT_EQ(256u, DILocalVariable::get(Context, getSubprogram(), "", getFile(), + 0, nullptr, 256, 0) ->getArg()); - EXPECT_EQ(257u, DILocalVariable::get(Context, dwarf::DW_TAG_arg_variable, - getSubprogram(), "", getFile(), 0, - nullptr, 257, 0) + EXPECT_EQ(257u, DILocalVariable::get(Context, getSubprogram(), "", getFile(), + 0, nullptr, 257, 0) ->getArg()); unsigned Max = UINT16_MAX; - EXPECT_EQ(Max, DILocalVariable::get(Context, dwarf::DW_TAG_arg_variable, - getSubprogram(), "", getFile(), 0, - nullptr, Max, 0) + EXPECT_EQ(Max, DILocalVariable::get(Context, getSubprogram(), "", getFile(), + 0, nullptr, Max, 0) ->getArg()); } |