chromium/third_party/spirv-tools/src/source/opt/instruction_list.h


// Copyright (c) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SOURCE_OPT_INSTRUCTION_LIST_H_
#define SOURCE_OPT_INSTRUCTION_LIST_H_

#include <cassert>
#include <functional>
#include <memory>
#include <utility>
#include <vector>

#include "source/latest_version_spirv_header.h"
#include "source/operand.h"
#include "source/opt/instruction.h"
#include "source/util/ilist.h"
#include "spirv-tools/libspirv.h"

namespace spvtools {
namespace opt {

// This class is intended to be the container for Instructions.  This container
// owns the instructions that are in it.  When removing an Instruction from the
// list, the caller is assuming responsibility for deleting the storage.
//
// TODO: Because there are a number of other data structures that will want
// pointers to instruction, ownership should probably be moved to the module.
// Because of that I have not made the ownership passing in this class fully
// explicit.  For example, RemoveFromList takes ownership from the list, but
// does not return an std::unique_ptr to signal that.  When we fully decide on
// ownership, this will have to be fixed up one way or the other.
class InstructionList : public utils::IntrusiveList<Instruction> {};

InstructionList::~InstructionList() {}

void InstructionList::clear() {}

}  // namespace opt
}  // namespace spvtools

#endif  // SOURCE_OPT_INSTRUCTION_LIST_H_