[PATCH] D118276: Adding a DIBuilder interface for Fortran's assumed length string
ykhatav via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 07:10:56 PST 2022
ykhatav updated this revision to Diff 404925.
ykhatav added a comment.
Updated the test to include the proper string functions
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118276/new/
https://reviews.llvm.org/D118276
Files:
llvm/unittests/IR/DebugInfoTest.cpp
Index: llvm/unittests/IR/DebugInfoTest.cpp
===================================================================
--- llvm/unittests/IR/DebugInfoTest.cpp
+++ llvm/unittests/IR/DebugInfoTest.cpp
@@ -259,25 +259,29 @@
DIVariable *StringLen = DIB.createAutoVariable(Scope, StrName, F, 0, nullptr,
false, DINode::FlagZero, 0);
DIExpression *StringLocationExp = DIB.createExpression();
- DIExpression *StringLengthExp = DIB.createExpression();
DIStringType *StringType =
DIB.createStringType(StrName, StringLen, StringLocationExp);
EXPECT_TRUE(isa_and_nonnull<DIStringType>(StringType));
- EXPECT_EQ(StringType->getName(), "string");
- EXPECT_EQ(StringType,
- DIStringType::get(Ctx, dwarf::DW_TAG_string_type, StrName,
- StringLen, StringLocationExp, nullptr, 0, 0, 0));
+ EXPECT_EQ(StringType->getName(), StrName);
+ EXPECT_EQ(StringType->getStringLength(), StringLen);
+ EXPECT_EQ(StringType->getStringLocationExp(), StringLocationExp);
+}
+TEST(DIBuilder, CreateStringTypeExp) {
+ LLVMContext Ctx;
+ std::unique_ptr<Module> M(new Module("MyModule", Ctx));
+ DIBuilder DIB(*M);
+ StringRef StrName = "string";
+ DIExpression *StringLocationExp = DIB.createExpression();
+ DIExpression *StringLengthExp = DIB.createExpression();
DIStringType *StringTypeExp =
DIB.createStringTypeExp(StrName, StringLengthExp, StringLocationExp);
EXPECT_TRUE(isa_and_nonnull<DIStringType>(StringTypeExp));
- EXPECT_EQ(StringTypeExp->getName(), "string");
- EXPECT_EQ(StringTypeExp,
- DIStringType::get(Ctx, dwarf::DW_TAG_string_type, StrName,
- StringLengthExp, StringLocationExp, nullptr, 0, 0,
- 0));
+ EXPECT_EQ(StringTypeExp->getName(), StrName);
+ EXPECT_EQ(StringTypeExp->getStringLengthExp(), StringLengthExp);
+ EXPECT_EQ(StringTypeExp->getStringLocationExp(), StringLocationExp);
}
TEST(DIBuilder, DIEnumerator) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118276.404925.patch
Type: text/x-patch
Size: 2016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/e2f003e0/attachment.bin>
More information about the llvm-commits
mailing list