[PATCH] D118276: Adding a DIBuilder interface for Fortran's assumed length string
ykhatav via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 11:23:39 PST 2022
ykhatav updated this revision to Diff 403734.
ykhatav added a comment.
Added StringLocationExp to the new apis
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118276/new/
https://reviews.llvm.org/D118276
Files:
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/IR/DIBuilder.cpp
llvm/unittests/IR/DebugInfoTest.cpp
Index: llvm/unittests/IR/DebugInfoTest.cpp
===================================================================
--- llvm/unittests/IR/DebugInfoTest.cpp
+++ llvm/unittests/IR/DebugInfoTest.cpp
@@ -252,11 +252,11 @@
std::unique_ptr<Module> M(new Module("MyModule", Ctx));
DIBuilder DIB(*M);
StringRef StrName = "string";
- DIStringType *StringType = DIB.createStringType(StrName,nullptr);
+ DIStringType *StringType = DIB.createStringType(StrName, nullptr);
EXPECT_TRUE(isa_and_nonnull<DIStringType>(StringType));
- EXPECT_EQ(StringType->getName(),"string");
- EXPECT_EQ(StringType->getStringLength(),nullptr);
+ EXPECT_EQ(StringType->getName(), "string");
+ EXPECT_EQ(StringType->getStringLength(), nullptr);
}
TEST(DIBuilder, DIEnumerator) {
Index: llvm/lib/IR/DIBuilder.cpp
===================================================================
--- llvm/lib/IR/DIBuilder.cpp
+++ llvm/lib/IR/DIBuilder.cpp
@@ -296,17 +296,19 @@
}
DIStringType *DIBuilder::createStringType(StringRef Name,
- PointerUnion<Metadata *, DIVariable *>StringLength, Metadata *StrLocationExp) {
+ Metadata *StringLength,
+ Metadata *StrLocationExp) {
assert(!Name.empty() && "Unable to create type without name");
return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
StringLength, nullptr, StrLocationExp, 0, 0, 0);
}
DIStringType *DIBuilder::createStringTypeExp(StringRef Name,
- DIExpression *StringLengthExp, Metadata *StrLocationExp) {
+ DIExpression *StringLengthExp,
+ Metadata *StrLocationExp) {
assert(!Name.empty() && "Unable to create type without name");
return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name, nullptr,
- StringLengthExp,StrLocationExp, 0, 0, 0);
+ StringLengthExp, StrLocationExp, 0, 0, 0);
}
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
Index: llvm/include/llvm/IR/DIBuilder.h
===================================================================
--- llvm/include/llvm/IR/DIBuilder.h
+++ llvm/include/llvm/IR/DIBuilder.h
@@ -220,21 +220,23 @@
/// \param Name Type name.
/// \param SizeInBits Size of the type.
DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
-
+
/// Create debugging information entry for Fortran
/// assumed length string type.
/// \param Name Type name.
- /// \param StringLength String length expressed either as Metadata * or DIVariable *.
+ /// \param StringLength String length expressed as Metadata *.
/// \param StrLocationExp Optional memory location of the string.
- DIStringType *createStringType(StringRef Name, PointerUnion<Metadata *, DIVariable *>StringLength, Metadata *StrLocationExp=nullptr);
-
+ DIStringType *createStringType(StringRef Name, Metadata *StringLength,
+ Metadata *StrLocationExp = nullptr);
+
/// Create debugging information entry for Fortran
/// assumed length string type.
- /// \param Name Type name.
+ /// \param Name Type name.
/// \param StringLengthExp String length expressed in DIExpression form.
- /// \param StrLocationExp Optional memory location of the string.
+ /// \param StrLocationExp Optional memory location of the string.
DIStringType *createStringTypeExp(StringRef Name,
- DIExpression *StringLengthExp, Metadata *StrLocationExp=nullptr);
+ DIExpression *StringLengthExp,
+ Metadata *StrLocationExp = nullptr);
/// Create debugging information entry for a qualified
/// type, e.g. 'const int'.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118276.403734.patch
Type: text/x-patch
Size: 4027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/d222158f/attachment.bin>
More information about the llvm-commits
mailing list