mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-14 18:30:19 +00:00
Add RemoveParameter method (#3437)
This commit is contained in:
parent
57d9e360c6
commit
99651228b2
@ -72,6 +72,10 @@ class Function {
|
||||
// Delete all basic blocks that contain no instructions.
|
||||
inline void RemoveEmptyBlocks();
|
||||
|
||||
// Removes a parameter from the function with result id equal to |id|.
|
||||
// Does nothing if the function doesn't have such a parameter.
|
||||
inline void RemoveParameter(uint32_t id);
|
||||
|
||||
// Saves the given function end instruction.
|
||||
inline void SetFunctionEnd(std::unique_ptr<Instruction> end_inst);
|
||||
|
||||
@ -219,6 +223,14 @@ inline void Function::RemoveEmptyBlocks() {
|
||||
blocks_.erase(first_empty, std::end(blocks_));
|
||||
}
|
||||
|
||||
inline void Function::RemoveParameter(uint32_t id) {
|
||||
params_.erase(std::remove_if(params_.begin(), params_.end(),
|
||||
[id](const std::unique_ptr<Instruction>& param) {
|
||||
return param->result_id() == id;
|
||||
}),
|
||||
params_.end());
|
||||
}
|
||||
|
||||
inline void Function::SetFunctionEnd(std::unique_ptr<Instruction> end_inst) {
|
||||
end_inst_ = std::move(end_inst);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user