Author: Vladislav Dzhidzhoev Date: 2026-05-13T03:46:00+02:00 New Revision: 2d485202b8e73f154840259af297a0f78cbe90d9
URL: https://github.com/llvm/llvm-project/commit/2d485202b8e73f154840259af297a0f78cbe90d9 DIFF: https://github.com/llvm/llvm-project/commit/2d485202b8e73f154840259af297a0f78cbe90d9.diff LOG: Revert "[DirectX][ObjectYAML] Add ILDN part support (#194508)" This reverts commit b239b5c07145df1fc3503bcde58481e21ba265a1. Added: Modified: llvm/include/llvm/BinaryFormat/DXContainer.h llvm/include/llvm/BinaryFormat/DXContainerConstants.def llvm/include/llvm/Object/DXContainer.h llvm/include/llvm/ObjectYAML/DXContainerYAML.h llvm/lib/MC/CMakeLists.txt llvm/lib/Object/DXContainer.cpp llvm/lib/ObjectYAML/DXContainerEmitter.cpp llvm/lib/ObjectYAML/DXContainerYAML.cpp llvm/tools/obj2yaml/dxcontainer2yaml.cpp llvm/unittests/Object/DXContainerTest.cpp llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp Removed: llvm/include/llvm/MC/DXContainerInfo.h llvm/lib/MC/DXContainerInfo.cpp llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-flags.yaml llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-length.yaml llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute.yaml llvm/test/tools/obj2yaml/DXContainer/ILDNPart.yaml ################################################################################ diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h index ae572ae7d965f..99bd32a2ff87a 100644 --- a/llvm/include/llvm/BinaryFormat/DXContainer.h +++ b/llvm/include/llvm/BinaryFormat/DXContainer.h @@ -805,19 +805,6 @@ enum class RootSignatureVersion { V1_2 = 0x3, }; -struct DebugNameHeader { - uint16_t Flags; - /// Debug file name length, without null terminator. - uint16_t NameLength; - - void swapBytes() { - sys::swapByteOrder(Flags); - sys::swapByteOrder(NameLength); - } -}; - -static_assert(sizeof(DebugNameHeader) == 4, "DebugNameHeader size incorrect."); - } // namespace dxbc } // namespace llvm diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def index 4c5070d18578c..f576d958037cd 100644 --- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def +++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def @@ -1,7 +1,6 @@ #ifdef CONTAINER_PART CONTAINER_PART(DXIL) -CONTAINER_PART(ILDN) CONTAINER_PART(SFI0) CONTAINER_PART(HASH) CONTAINER_PART(PSV0) diff --git a/llvm/include/llvm/MC/DXContainerInfo.h b/llvm/include/llvm/MC/DXContainerInfo.h deleted file mode 100644 index 78d4b4da45558..0000000000000 --- a/llvm/include/llvm/MC/DXContainerInfo.h +++ /dev/null @@ -1,32 +0,0 @@ -//===----- llvm/MC/DXContainerInfo.h - DXContainer Info ---------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_MC_DXCONTAINERINFO_H -#define LLVM_MC_DXCONTAINERINFO_H - -#include "llvm/Object/DXContainer.h" - -namespace llvm { - -class raw_ostream; - -namespace mcdxbc { - -struct DebugName { - object::DXContainer::ILDNData BaseData; - - DebugName() { BaseData.first.Flags = 0; } - - void setFileName(StringRef FileName); - void write(raw_ostream &OS) const; -}; - -} // namespace mcdxbc -} // namespace llvm - -#endif // LLVM_MC_DXCONTAINERINFO_H diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h index f2ce39770b097..c5888b87d6ad7 100644 --- a/llvm/include/llvm/Object/DXContainer.h +++ b/llvm/include/llvm/Object/DXContainer.h @@ -460,7 +460,6 @@ class Signature { class DXContainer { public: using DXILData = std::pair<dxbc::ProgramHeader, const char *>; - using ILDNData = std::pair<dxbc::DebugNameHeader, StringRef>; private: DXContainer(MemoryBufferRef O); @@ -476,12 +475,10 @@ class DXContainer { DirectX::Signature InputSignature; DirectX::Signature OutputSignature; DirectX::Signature PatchConstantSignature; - std::optional<ILDNData> DebugName; Error parseHeader(); Error parsePartOffsets(); Error parseDXILHeader(StringRef Part); - Error parseDebugName(StringRef Part); Error parseShaderFeatureFlags(StringRef Part); Error parseHash(StringRef Part); Error parseRootSignature(StringRef Part); @@ -566,8 +563,6 @@ class DXContainer { const std::optional<DXILData> &getDXIL() const { return DXIL; } - const std::optional<ILDNData> getDebugName() const { return DebugName; } - std::optional<uint64_t> getShaderFeatureFlags() const { return ShaderFeatureFlags; } diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h index 6f62df54cd2bb..e95e047f546d7 100644 --- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h +++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h @@ -296,12 +296,6 @@ struct Signature { llvm::SmallVector<SignatureParameter> Parameters; }; -struct DebugName { - std::optional<uint16_t> Flags; - std::optional<uint16_t> NameLength; - std::string DebugName; -}; - struct Part { Part() = default; Part(std::string N, uint32_t S) : Name(N), Size(S) {} @@ -313,7 +307,6 @@ struct Part { std::optional<PSVInfo> Info; std::optional<DXContainerYAML::Signature> Signature; std::optional<DXContainerYAML::RootSignatureYamlDesc> RootSignature; - std::optional<DXContainerYAML::DebugName> DebugName; }; struct Object { @@ -380,10 +373,6 @@ template <> struct MappingTraits<DXContainerYAML::PSVInfo> { LLVM_ABI static void mapping(IO &IO, DXContainerYAML::PSVInfo &PSV); }; -template <> struct MappingTraits<DXContainerYAML::DebugName> { - LLVM_ABI static void mapping(IO &IO, DXContainerYAML::DebugName &DebugName); -}; - template <> struct MappingTraits<DXContainerYAML::Part> { LLVM_ABI static void mapping(IO &IO, DXContainerYAML::Part &Version); }; diff --git a/llvm/lib/MC/CMakeLists.txt b/llvm/lib/MC/CMakeLists.txt index b85cbaa08a653..7a9e26af415c6 100644 --- a/llvm/lib/MC/CMakeLists.txt +++ b/llvm/lib/MC/CMakeLists.txt @@ -1,6 +1,5 @@ add_llvm_component_library(LLVMMC ConstantPools.cpp - DXContainerInfo.cpp DXContainerPSVInfo.cpp DXContainerRootSignature.cpp ELFObjectWriter.cpp diff --git a/llvm/lib/MC/DXContainerInfo.cpp b/llvm/lib/MC/DXContainerInfo.cpp deleted file mode 100644 index f32a0fe3a7cdf..0000000000000 --- a/llvm/lib/MC/DXContainerInfo.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===- llvm/MC/DXContainerInfo.cpp - DXContainer Info -----*- C++ -------*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/MC/DXContainerInfo.h" -#include "llvm/BinaryFormat/DXContainer.h" -#include "llvm/Object/DXContainer.h" -#include "llvm/Support/SwapByteOrder.h" -#include <type_traits> - -using namespace llvm; -using namespace llvm::mcdxbc; - -template <typename StructT> -static void writeStruct(raw_ostream &OS, StructT S) { - static_assert(std::is_class<StructT>() && - "This method must be used for writing structure types"); - if (sys::IsBigEndianHost) - S.swapBytes(); - OS.write(reinterpret_cast<const char *>(&S), sizeof(StructT)); -} - -static void writeString(raw_ostream &OS, StringRef S) { - OS.write(S.data(), S.size()); - // Write null terminator. - OS.write_zeros(1); -} - -void DebugName::setFileName(StringRef DebugFileName) { - BaseData.first.NameLength = DebugFileName.size(); - BaseData.second = DebugFileName; -} - -void DebugName::write(raw_ostream &OS) const { - writeStruct(OS, BaseData.first); - writeString(OS, BaseData.second.substr(0, BaseData.first.NameLength)); -} diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp index 713958b9252ad..7b7b8d88c63fc 100644 --- a/llvm/lib/Object/DXContainer.cpp +++ b/llvm/lib/Object/DXContainer.cpp @@ -20,14 +20,10 @@ static Error parseFailed(const Twine &Msg) { return make_error<GenericBinaryError>(Msg.str(), object_error::parse_failed); } -static bool readIsOutOfBounds(StringRef Buffer, const char *Src, size_t Size) { - return Src < Buffer.begin() || Src + Size > Buffer.end(); -} - template <typename T> static Error readStruct(StringRef Buffer, const char *Src, T &Struct) { // Don't read before the beginning or past the end of the file - if (readIsOutOfBounds(Buffer, Src, sizeof(T))) + if (Src < Buffer.begin() || Src + sizeof(T) > Buffer.end()) return parseFailed("Reading structure out of file bounds"); memcpy(&Struct, Src, sizeof(T)); @@ -43,7 +39,7 @@ static Error readInteger(StringRef Buffer, const char *Src, T &Val, static_assert(std::is_integral_v<T>, "Cannot call readInteger on non-integral type."); // Don't read before the beginning or past the end of the file - if (readIsOutOfBounds(Buffer, Src, sizeof(T))) + if (Src < Buffer.begin() || Src + sizeof(T) > Buffer.end()) return parseFailed(Twine("Reading ") + Str + " out of file bounds"); // The DXContainer offset table is comprised of uint32_t values but not padded @@ -59,22 +55,6 @@ static Error readInteger(StringRef Buffer, const char *Src, T &Val, return Error::success(); } -static Error readString(StringRef Buffer, const char *&Src, size_t MaxSize, - StringRef &Val, Twine Desc) { - if (readIsOutOfBounds(Buffer, Src, MaxSize)) - return parseFailed(Desc + " is out of file bounds"); - - // Ensure that the null-terminator is somewhere within MaxSize bytes. - Buffer = Buffer.substr(Src - Buffer.data(), MaxSize); - size_t Length = Buffer.find('\0'); - if (Length == Buffer.npos) - return parseFailed(Desc + " does not end with null-terminator"); - - Val = StringRef(Buffer.data(), Length); - Src += Length + 1; - return Error::success(); -} - DXContainer::DXContainer(MemoryBufferRef O) : Data(O) {} Error DXContainer::parseHeader() { @@ -93,26 +73,6 @@ Error DXContainer::parseDXILHeader(StringRef Part) { return Error::success(); } -Error DXContainer::parseDebugName(StringRef Part) { - if (DebugName) - return parseFailed("more than one ILDN part is present in the file"); - const char *Current = Part.begin(); - dxbc::DebugNameHeader Header; - if (Error Err = readStruct(Part, Current, Header)) - return Err; - Current += sizeof(Header); - - StringRef Name; - if (Error Err = readString(Part, Current, Header.NameLength + 1, Name, - "debug file name")) - return Err; - if (Name.size() != Header.NameLength) - return parseFailed("debug file name length mismatch"); - DebugName.emplace(Header, Name.data()); - - return Error::success(); -} - Error DXContainer::parseShaderFeatureFlags(StringRef Part) { if (ShaderFeatureFlags) return parseFailed("More than one SFI0 part is present in the file"); @@ -217,10 +177,6 @@ Error DXContainer::parsePartOffsets() { if (Error Err = parseDXILHeader(PartData)) return Err; break; - case dxbc::PartType::ILDN: - if (Error Err = parseDebugName(PartData)) - return Err; - break; case dxbc::PartType::SFI0: if (Error Err = parseShaderFeatureFlags(PartData)) return Err; diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp index 05937999991b6..312c74befd752 100644 --- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp +++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/BinaryFormat/DXContainer.h" -#include "llvm/MC/DXContainerInfo.h" #include "llvm/MC/DXContainerPSVInfo.h" #include "llvm/MC/DXContainerRootSignature.h" #include "llvm/ObjectYAML/ObjectYAML.h" @@ -173,21 +172,6 @@ Error DXContainerWriter::writeParts(raw_ostream &OS) { } break; } - case dxbc::PartType::ILDN: { - if (!P.DebugName) - continue; - - mcdxbc::DebugName DebugName; - DebugName.setFileName(P.DebugName->DebugName); - // Override default flags with value from YAML. - if (P.DebugName->Flags) - DebugName.BaseData.first.Flags = *P.DebugName->Flags; - // Override computed filename length with value from YAML. - if (P.DebugName->NameLength) - DebugName.BaseData.first.NameLength = *P.DebugName->NameLength; - DebugName.write(OS); - break; - } case dxbc::PartType::SFI0: { // If we don't have any flags we can continue here and the data will be // zeroed out. diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp index 9e7d9be552e62..f81bf5f55cddd 100644 --- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp +++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp @@ -535,13 +535,6 @@ void MappingTraits<llvm::DXContainerYAML::StaticSamplerYamlDesc>::mapping( #include "llvm/BinaryFormat/DXContainerConstants.def" } -void MappingTraits<DXContainerYAML::DebugName>::mapping( - IO &IO, DXContainerYAML::DebugName &DebugName) { - IO.mapOptional("Flags", DebugName.Flags); - IO.mapOptional("NameLength", DebugName.NameLength); - IO.mapRequired("DebugName", DebugName.DebugName); -} - void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO, DXContainerYAML::Part &P) { IO.mapRequired("Name", P.Name); @@ -552,7 +545,6 @@ void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO, IO.mapOptional("PSVInfo", P.Info); IO.mapOptional("Signature", P.Signature); IO.mapOptional("RootSignature", P.RootSignature); - IO.mapOptional("DebugName", P.DebugName); } void MappingTraits<DXContainerYAML::Object>::mapping( diff --git a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-flags.yaml b/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-flags.yaml deleted file mode 100644 index ea92645b28436..0000000000000 --- a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-flags.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# RUN: yaml2obj %s 2>&1 | obj2yaml 2>&1 | FileCheck %s - ---- !dxcontainer -Header: - Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] - Version: - Major: 1 - Minor: 0 - FileSize: 88 - PartCount: 1 - PartOffsets: [36] -Parts: - - Name: ILDN - Size: 44 - DebugName: - NameLength: 36 - DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb -... - -#CHECK: - Name: ILDN -#CHECK-NEXT: Size: 44 -#CHECK-NEXT: DebugName: -#CHECK-NEXT: Flags: 0 -#CHECK-NEXT: NameLength: 36 -#CHECK-NEXT: DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb diff --git a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-length.yaml b/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-length.yaml deleted file mode 100644 index 128135ed91188..0000000000000 --- a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute-length.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# RUN: yaml2obj %s 2>&1 | obj2yaml 2>&1 | FileCheck %s - ---- !dxcontainer -Header: - Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] - Version: - Major: 1 - Minor: 0 - FileSize: 88 - PartCount: 1 - PartOffsets: [36] -Parts: - - Name: ILDN - Size: 44 - DebugName: - Flags: 0 - DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb -... - -#CHECK: - Name: ILDN -#CHECK-NEXT: Size: 44 -#CHECK-NEXT: DebugName: -#CHECK-NEXT: Flags: 0 -#CHECK-NEXT: NameLength: 36 -#CHECK-NEXT: DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb diff --git a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute.yaml b/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute.yaml deleted file mode 100644 index f6f47f1809c97..0000000000000 --- a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart-compute.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# RUN: yaml2obj %s 2>&1 | obj2yaml 2>&1 | FileCheck %s - ---- !dxcontainer -Header: - Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] - Version: - Major: 1 - Minor: 0 - FileSize: 88 - PartCount: 1 - PartOffsets: [36] -Parts: - - Name: ILDN - Size: 44 - DebugName: - DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb -... - -#CHECK: - Name: ILDN -#CHECK-NEXT: Size: 44 -#CHECK-NEXT: DebugName: -#CHECK-NEXT: Flags: 0 -#CHECK-NEXT: NameLength: 36 -#CHECK-NEXT: DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb diff --git a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart.yaml b/llvm/test/tools/obj2yaml/DXContainer/ILDNPart.yaml deleted file mode 100644 index 02e42417f39d8..0000000000000 --- a/llvm/test/tools/obj2yaml/DXContainer/ILDNPart.yaml +++ /dev/null @@ -1,64 +0,0 @@ -# RUN: yaml2obj %s 2>&1 | obj2yaml 2>&1 | FileCheck %s - ---- !dxcontainer -Header: - Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] - Version: - Major: 1 - Minor: 0 - FileSize: 3600 - PartCount: 8 - PartOffsets: [64, 80, 96, 112, 240, 1936, 1964, 2016] -Parts: - - Name: FKE0 - Size: 8 - - Name: FKE1 - Size: 8 - - Name: FKE2 - Size: 8 - - Name: FKE3 - Size: 120 - - Name: FKE4 - Size: 1688 - - Name: FKE5 - Size: 20 - - Name: ILDN - Size: 44 - DebugName: - Flags: 0 - NameLength: 36 - DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb - - Name: DXIL - Size: 28 - Program: - MajorVersion: 6 - MinorVersion: 5 - ShaderKind: 5 - Size: 7 - DXILMajorVersion: 1 - DXILMinorVersion: 5 - DXILSize: 4 - DXIL: [ 0x42, 0x43, 0xC0, 0xDE, ] -... - - - - -#CHECK: - Name: ILDN -#CHECK-NEXT: Size: 44 -#CHECK-NEXT: DebugName: -#CHECK-NEXT: Flags: 0 -#CHECK-NEXT: NameLength: 36 -#CHECK-NEXT: DebugName: 0b40fc8650d90fa2e9fd5cadc8eaaace.pdb -#CHECK-NEXT: - Name: DXIL -#CHECK-NEXT: Size: 28 -#CHECK-NEXT: Program: -#CHECK-NEXT: MajorVersion: 6 -#CHECK-NEXT: MinorVersion: 5 -#CHECK-NEXT: ShaderKind: 5 -#CHECK-NEXT: Size: 7 -#CHECK-NEXT: DXILMajorVersion: 1 -#CHECK-NEXT: DXILMinorVersion: 5 -#CHECK-NEXT: DXILSize: 4 -#CHECK-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp index 8095bf8b24abe..09a6422d0d7b9 100644 --- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp +++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp @@ -70,15 +70,6 @@ dumpDXContainer(MemoryBufferRef Source) { DXIL->second, DXIL->second + DXIL->first.Bitcode.Size)}; break; } - case dxbc::PartType::ILDN: { - std::optional<DXContainer::ILDNData> DebugName = Container.getDebugName(); - assert(DebugName && "Since we are iterating and found a ILDN part, this " - "should never not have a value"); - NewPart.DebugName = DXContainerYAML::DebugName{ - DebugName->first.Flags, DebugName->first.NameLength, - DebugName->second.str()}; - break; - } case dxbc::PartType::SFI0: { std::optional<uint64_t> Flags = Container.getShaderFeatureFlags(); // Omit the flags in the YAML if they are missing or zero. diff --git a/llvm/unittests/Object/DXContainerTest.cpp b/llvm/unittests/Object/DXContainerTest.cpp index 3769b527c65ac..ac8b45825c04d 100644 --- a/llvm/unittests/Object/DXContainerTest.cpp +++ b/llvm/unittests/Object/DXContainerTest.cpp @@ -221,42 +221,6 @@ TEST(DXCFile, ParseDXILPart) { EXPECT_EQ(Header.Bitcode.MinorVersion, 5u); } -// This test verifies that ILDN part is correctly parsed. -// This test is based on the binary output constructed from this yaml. -// --- !dxcontainer -// Header: -// Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -// 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] -// Version: -// Major: 1 -// Minor: 0 -// PartCount: 1 -// Parts: -// - Name: ILDN -// Size: 12 -// DebugName: -// Flags: 0 -// NameLength: 7 -// DebugName: abc.pdb -// ... -TEST(DXCFile, ParseILDNPart) { - uint8_t Buffer[] = { - 0x44, 0x58, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x49, 0x4C, 0x44, 0x4E, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, - 0x61, 0x62, 0x63, 0x2E, 0x70, 0x64, 0x62, 0x00}; - DXContainer C = - llvm::cantFail(DXContainer::create(getMemoryBuffer<116>(Buffer))); - EXPECT_EQ(C.getHeader().PartCount, 1u); - const std::optional<object::DXContainer::ILDNData> &ILDN = C.getDebugName(); - EXPECT_TRUE(ILDN.has_value()); - dxbc::DebugNameHeader Header = ILDN->first; - EXPECT_EQ(Header.Flags, 0u); - EXPECT_EQ(Header.NameLength, 7u); - EXPECT_EQ(ILDN->second, "abc.pdb"); -} - static Expected<DXContainer> generateDXContainer(StringRef Yaml, SmallVectorImpl<char> &BinaryData) { DXContainerYAML::Object Obj; diff --git a/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp b/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp index d6226b368e5df..1b21fe01dfca9 100644 --- a/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp +++ b/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp @@ -577,36 +577,3 @@ TEST(RootSignature, ParseStaticSamplersV13) { EXPECT_EQ(Storage.size(), 148U); EXPECT_TRUE(memcmp(Buffer, Storage.data(), 148U) == 0); } - -TEST(DXCFile, ParseILDNPart) { - SmallString<128> Storage; - - // First read a fully explicit yaml with all sizes and offsets provided - ASSERT_TRUE(convert(Storage, R"(--- !dxcontainer -Header: - Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] - Version: - Major: 1 - Minor: 0 - PartCount: 1 - PartOffsets: [ 36 ] -Parts: - - Name: ILDN - Size: 12 - DebugName: - Flags: 0 - NameLength: 7 - DebugName: abc.pdb - )")); - - uint8_t Buffer[] = { - 0x44, 0x58, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x49, 0x4C, 0x44, 0x4E, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, - 0x61, 0x62, 0x63, 0x2E, 0x70, 0x64, 0x62, 0x00}; - - EXPECT_EQ(Storage.size(), 56u); - EXPECT_TRUE(memcmp(Buffer, Storage.data(), 56u) == 0); -} _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
