Files
llvm-project/llvm/lib/ObjCopy/DXContainer/DXContainerObject.cpp
Finn Plummer 87a1d42bed [DirectX] Add support for remove-section of DXContainer for llvm-objcopy (#153246)
This pr implements the `remove-section` option for a `DXContainer`
object in `llvm-objcopy`.

It implements a base `removeParts` to the minimal `object`
representation of a `DXContainerObject`.

This is the second step to implement
https://github.com/llvm/llvm-project/issues/150275 as a compiler actions
that invokes llvm-objcopy for functionality.
2025-08-21 10:30:54 -07:00

30 lines
806 B
C++

//===- DXContainerObject.cpp ----------------------------------------------===//
//
// 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 "DXContainerObject.h"
namespace llvm {
namespace objcopy {
namespace dxbc {
Error Object::removeParts(PartPred ToRemove) {
erase_if(Parts, ToRemove);
return Error::success();
}
void Object::recomputeHeader() {
Header.FileSize = headerSize();
Header.PartCount = Parts.size();
for (const Part &P : Parts)
Header.FileSize += P.size();
}
} // end namespace dxbc
} // end namespace objcopy
} // end namespace llvm