| 1 | //===- DXContainerObject.h --------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_LIB_OBJCOPY_DXCONTAINER_DXCONTAINEROBJECT_H |
| 10 | #define LLVM_LIB_OBJCOPY_DXCONTAINER_DXCONTAINEROBJECT_H |
| 11 | |
| 12 | #include "llvm/ADT/ArrayRef.h" |
| 13 | #include "llvm/ADT/StringRef.h" |
| 14 | #include "llvm/Object/DXContainer.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | namespace objcopy { |
| 18 | namespace dxbc { |
| 19 | |
| 20 | using namespace object; |
| 21 | |
| 22 | struct Part { |
| 23 | StringRef Name; |
| 24 | ArrayRef<uint8_t> Data; |
| 25 | |
| 26 | size_t size() const { |
| 27 | return sizeof(::llvm::dxbc::PartHeader) // base header |
| 28 | + Data.size(); // contents size |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | using PartPred = llvm::function_ref<bool(const Part &)>; |
| 33 | |
| 34 | struct Object { |
| 35 | ::llvm::dxbc::Header ; |
| 36 | SmallVector<Part> Parts; |
| 37 | |
| 38 | size_t () const { |
| 39 | return sizeof(::llvm::dxbc::Header) // base header |
| 40 | + sizeof(uint32_t) * Parts.size(); // part offset values |
| 41 | } |
| 42 | |
| 43 | Error removeParts(PartPred ToRemove); |
| 44 | void (); |
| 45 | }; |
| 46 | |
| 47 | } // end namespace dxbc |
| 48 | } // end namespace objcopy |
| 49 | } // end namespace llvm |
| 50 | |
| 51 | #endif // LLVM_LIB_OBJCOPY_DXCONTAINER_DXCONTAINEROBJECT_H |
| 52 | |