From ae76729a015478fdfe1477653c36bfe390445f0d Mon Sep 17 00:00:00 2001 From: Mitch Phillips <31459023+hctim@users.noreply.github.com> Date: Tue, 27 Oct 2020 20:34:48 -0700 Subject: [PATCH] Revert "[DebugInfo] Expose Fortran array debug info attributes through DIBuilder." This reverts commit 5b3bf8b453b8cc00efd5269009a1e63c4442a30e. This caused a regression in the ASan buildbot. See comments at https://reviews.llvm.org/D89817 for more information. --- llvm/include/llvm/IR/DIBuilder.h | 20 ++---------------- llvm/lib/IR/DIBuilder.cpp | 24 ++++++---------------- llvm/unittests/IR/DebugInfoTest.cpp | 41 ------------------------------------- 3 files changed, 8 insertions(+), 77 deletions(-) diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h index e337b8b..0c788a1 100644 --- a/llvm/include/llvm/IR/DIBuilder.h +++ b/llvm/include/llvm/IR/DIBuilder.h @@ -494,24 +494,8 @@ namespace llvm { /// \param AlignInBits Alignment. /// \param Ty Element type. /// \param Subscripts Subscripts. - /// \param DataLocation The location of the raw data of a descriptor-based - /// Fortran array, either a DIExpression* or - /// a DIVariable*. - /// \param Associated The associated attribute of a descriptor-based - /// Fortran array, either a DIExpression* or - /// a DIVariable*. - /// \param Allocated The allocated attribute of a descriptor-based - /// Fortran array, either a DIExpression* or - /// a DIVariable*. - /// \param Rank The rank attribute of a descriptor-based - /// Fortran array, either a DIExpression* or - /// a DIVariable*. - DICompositeType *createArrayType( - uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, - PointerUnion DataLocation = nullptr, - PointerUnion Associated = nullptr, - PointerUnion Allocated = nullptr, - PointerUnion Rank = nullptr); + DICompositeType *createArrayType(uint64_t Size, uint32_t AlignInBits, + DIType *Ty, DINodeArray Subscripts); /// Create debugging information entry for a vector type. /// \param Size Array size. diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 042f0693..6717aa6 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -525,24 +525,12 @@ DICompositeType *DIBuilder::createEnumerationType( return CTy; } -DICompositeType *DIBuilder::createArrayType( - uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, - PointerUnion DL, - PointerUnion AS, - PointerUnion AL, - PointerUnion RK) { - auto *R = DICompositeType::get( - VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, - nullptr, Ty, Size, AlignInBits, 0, DINode::FlagZero, - Subscripts, 0, nullptr, nullptr, "", nullptr, - DL.is() ? (Metadata *)DL.get() - : (Metadata *)DL.get(), - AS.is() ? (Metadata *)AS.get() - : (Metadata *)AS.get(), - AL.is() ? (Metadata *)AL.get() - : (Metadata *)AL.get(), - RK.is() ? (Metadata *)RK.get() - : (Metadata *)RK.get()); +DICompositeType *DIBuilder::createArrayType(uint64_t Size, + uint32_t AlignInBits, DIType *Ty, + DINodeArray Subscripts) { + auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", + nullptr, 0, nullptr, Ty, Size, AlignInBits, 0, + DINode::FlagZero, Subscripts, 0, nullptr); trackIfUnresolved(R); return R; } diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp index f49ceee..900823a 100644 --- a/llvm/unittests/IR/DebugInfoTest.cpp +++ b/llvm/unittests/IR/DebugInfoTest.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/DebugInfo.h" -#include "llvm/IR/DIBuilder.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/IntrinsicInst.h" @@ -186,44 +185,4 @@ TEST(MetadataTest, DeleteInstUsedByDbgValue) { EXPECT_TRUE(isa(DVIs[0]->getValue())); } -TEST(DIBuilder, CreateFortranArrayTypeWithAttributes) { - LLVMContext Ctx; - std::unique_ptr M(new Module("MyModule", Ctx)); - DIBuilder DIB(*M); - - DISubrange *Subrange = DIB.getOrCreateSubrange(1,1); - SmallVector Subranges; - Subranges.push_back(Subrange); - DINodeArray Subscripts = DIB.getOrCreateArray(Subranges); - - auto getDIExpression = [&DIB](int offset) { - SmallVector ops; - ops.push_back(llvm::dwarf::DW_OP_push_object_address); - DIExpression::appendOffset(ops, offset); - ops.push_back(llvm::dwarf::DW_OP_deref); - - return DIB.createExpression(ops); - }; - - DIFile *F = DIB.createFile("main.c", "/"); - DICompileUnit *CU = DIB.createCompileUnit( - dwarf::DW_LANG_C, DIB.createFile("main.c", "/"), "llvm-c", true, "", 0); - - DIVariable *DataLocation = - DIB.createTempGlobalVariableFwdDecl(CU, "dl", "_dl", F, 1, nullptr, true); - DIExpression *Associated = getDIExpression(1); - DIExpression *Allocated = getDIExpression(2); - DIExpression *Rank = DIB.createConstantValueExpression(3); - - DICompositeType *ArrayType = DIB.createArrayType(0, 0, nullptr, Subscripts, - DataLocation, Associated, - Allocated, Rank); - - EXPECT_TRUE(isa_and_nonnull(ArrayType)); - EXPECT_EQ(ArrayType->getRawDataLocation(), DataLocation); - EXPECT_EQ(ArrayType->getRawAssociated(), Associated); - EXPECT_EQ(ArrayType->getRawAllocated(), Allocated); - EXPECT_EQ(ArrayType->getRawRank(), Rank); -} - } // end namespace -- 2.7.4