summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-08-01 14:58:12 -0400
committerGitHub <noreply@github.com>2018-08-01 14:58:12 -0400
commita5a5ea0e2dfce9c755a88af1074ebe68a44d2ed9 (patch)
treeab2e8cd2b5162303a50a9337cdba42ca2de05bb0 /source
parentebd6c75a710893305958e8db5cd2df0eef2b793b (diff)
Remove using std::<foo> statements. (#1756)
Many of the files have using std::<foo> statements in them, but then the use of <foo> will be inconsistently std::<foo> or <foo> scattered through the file. This CL removes all of the using statements and updates the code to have the required std:: prefix.
Diffstat (limited to 'source')
-rw-r--r--source/cfa.h61
-rw-r--r--source/opt/cfg.cpp5
-rw-r--r--source/opt/local_single_store_elim_pass.cpp4
-rw-r--r--source/opt/mem_pass.cpp4
-rw-r--r--source/val/basic_block.cpp5
-rw-r--r--source/val/function.cpp38
-rw-r--r--source/val/instruction.cpp4
-rw-r--r--source/val/validate.cpp22
-rw-r--r--source/val/validate_cfg.cpp67
-rw-r--r--source/val/validate_decorations.cpp11
-rw-r--r--source/val/validate_id.cpp30
-rw-r--r--source/val/validation_state.cpp4
12 files changed, 108 insertions, 147 deletions
diff --git a/source/cfa.h b/source/cfa.h
index 89adf1bc..9e7081b9 100644
--- a/source/cfa.h
+++ b/source/cfa.h
@@ -25,14 +25,6 @@
#include <utility>
#include <vector>
-using std::find;
-using std::function;
-using std::get;
-using std::pair;
-using std::unordered_map;
-using std::unordered_set;
-using std::vector;
-
namespace spvtools {
// Control Flow Analysis of control flow graphs of basic block nodes |BB|.
@@ -111,8 +103,8 @@ class CFA {
/// block
/// without predecessors (such as the root node) is its own immediate
/// dominator.
- static vector<pair<BB*, BB*>> CalculateDominators(
- const vector<cbb_ptr>& postorder, get_blocks_func predecessor_func);
+ static std::vector<std::pair<BB*, BB*>> CalculateDominators(
+ const std::vector<cbb_ptr>& postorder, get_blocks_func predecessor_func);
// Computes a minimal set of root nodes required to traverse, in the forward
// direction, the CFG represented by the given vector of blocks, and successor
@@ -133,7 +125,8 @@ class CFA {
};
template <class BB>
-bool CFA<BB>::FindInWorkList(const vector<block_info>& work_list, uint32_t id) {
+bool CFA<BB>::FindInWorkList(const std::vector<block_info>& work_list,
+ uint32_t id) {
for (const auto b : work_list) {
if (b.block->id() == id) return true;
}
@@ -141,19 +134,19 @@ bool CFA<BB>::FindInWorkList(const vector<block_info>& work_list, uint32_t id) {
}
template <class BB>
-void CFA<BB>::DepthFirstTraversal(const BB* entry,
- get_blocks_func successor_func,
- function<void(cbb_ptr)> preorder,
- function<void(cbb_ptr)> postorder,
- function<void(cbb_ptr, cbb_ptr)> backedge) {
- unordered_set<uint32_t> processed;
+void CFA<BB>::DepthFirstTraversal(
+ const BB* entry, get_blocks_func successor_func,
+ std::function<void(cbb_ptr)> preorder,
+ std::function<void(cbb_ptr)> postorder,
+ std::function<void(cbb_ptr, cbb_ptr)> backedge) {
+ std::unordered_set<uint32_t> processed;
/// NOTE: work_list is the sequence of nodes from the root node to the node
/// being processed in the traversal
- vector<block_info> work_list;
+ std::vector<block_info> work_list;
work_list.reserve(10);
- work_list.push_back({entry, begin(*successor_func(entry))});
+ work_list.push_back({entry, std::begin(*successor_func(entry))});
preorder(entry);
processed.insert(entry->id());
@@ -171,7 +164,7 @@ void CFA<BB>::DepthFirstTraversal(const BB* entry,
if (processed.count(child->id()) == 0) {
preorder(child);
work_list.emplace_back(
- block_info{child, begin(*successor_func(child))});
+ block_info{child, std::begin(*successor_func(child))});
processed.insert(child->id());
}
}
@@ -179,15 +172,15 @@ void CFA<BB>::DepthFirstTraversal(const BB* entry,
}
template <class BB>
-vector<pair<BB*, BB*>> CFA<BB>::CalculateDominators(
- const vector<cbb_ptr>& postorder, get_blocks_func predecessor_func) {
+std::vector<std::pair<BB*, BB*>> CFA<BB>::CalculateDominators(
+ const std::vector<cbb_ptr>& postorder, get_blocks_func predecessor_func) {
struct block_detail {
size_t dominator; ///< The index of blocks's dominator in post order array
size_t postorder_index; ///< The index of the block in the post order array
};
const size_t undefined_dom = postorder.size();
- unordered_map<cbb_ptr, block_detail> idoms;
+ std::unordered_map<cbb_ptr, block_detail> idoms;
for (size_t i = 0; i < postorder.size(); i++) {
idoms[postorder[i]] = {undefined_dom, i};
}
@@ -197,14 +190,14 @@ vector<pair<BB*, BB*>> CFA<BB>::CalculateDominators(
while (changed) {
changed = false;
for (auto b = postorder.rbegin() + 1; b != postorder.rend(); ++b) {
- const vector<BB*>& predecessors = *predecessor_func(*b);
+ const std::vector<BB*>& predecessors = *predecessor_func(*b);
// Find the first processed/reachable predecessor that is reachable
// in the forward traversal.
- auto res = find_if(begin(predecessors), end(predecessors),
- [&idoms, undefined_dom](BB* pred) {
- return idoms.count(pred) &&
- idoms[pred].dominator != undefined_dom;
- });
+ auto res = std::find_if(std::begin(predecessors), std::end(predecessors),
+ [&idoms, undefined_dom](BB* pred) {
+ return idoms.count(pred) &&
+ idoms[pred].dominator != undefined_dom;
+ });
if (res == end(predecessors)) continue;
const BB* idom = *res;
size_t idom_idx = idoms[idom].postorder_index;
@@ -237,19 +230,19 @@ vector<pair<BB*, BB*>> CFA<BB>::CalculateDominators(
}
}
- vector<pair<bb_ptr, bb_ptr>> out;
+ std::vector<std::pair<bb_ptr, bb_ptr>> out;
for (auto idom : idoms) {
// NOTE: performing a const cast for convenient usage with
// UpdateImmediateDominators
- out.push_back({const_cast<BB*>(get<0>(idom)),
- const_cast<BB*>(postorder[get<1>(idom).dominator])});
+ out.push_back({const_cast<BB*>(std::get<0>(idom)),
+ const_cast<BB*>(postorder[std::get<1>(idom).dominator])});
}
// Sort by postorder index to generate a deterministic ordering of edges.
std::sort(
out.begin(), out.end(),
- [&idoms](const pair<bb_ptr, bb_ptr>& lhs,
- const pair<bb_ptr, bb_ptr>& rhs) {
+ [&idoms](const std::pair<bb_ptr, bb_ptr>& lhs,
+ const std::pair<bb_ptr, bb_ptr>& rhs) {
assert(lhs.first);
assert(lhs.second);
assert(rhs.first);
diff --git a/source/opt/cfg.cpp b/source/opt/cfg.cpp
index 8625358c..fa3e50f3 100644
--- a/source/opt/cfg.cpp
+++ b/source/opt/cfg.cpp
@@ -143,8 +143,9 @@ void CFG::ComputeStructuredSuccessors(Function* func) {
}
}
-void CFG::ComputePostOrderTraversal(BasicBlock* bb, vector<BasicBlock*>* order,
- unordered_set<BasicBlock*>* seen) {
+void CFG::ComputePostOrderTraversal(BasicBlock* bb,
+ std::vector<BasicBlock*>* order,
+ std::unordered_set<BasicBlock*>* seen) {
seen->insert(bb);
static_cast<const BasicBlock*>(bb)->ForEachSuccessorLabel(
[&order, &seen, this](const uint32_t sbid) {
diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp
index 225356e5..66c1505e 100644
--- a/source/opt/local_single_store_elim_pass.cpp
+++ b/source/opt/local_single_store_elim_pass.cpp
@@ -116,7 +116,7 @@ void LocalSingleStoreElimPass::InitExtensionWhiteList() {
});
}
bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) {
- vector<Instruction*> users;
+ std::vector<Instruction*> users;
FindUses(var_inst, &users);
Instruction* store_inst = FindSingleStoreAndCheckUses(var_inst, users);
@@ -129,7 +129,7 @@ bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) {
}
Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses(
- Instruction* var_inst, const vector<Instruction*>& users) const {
+ Instruction* var_inst, const std::vector<Instruction*>& users) const {
// Make sure there is exactly 1 store.
Instruction* store_inst = nullptr;
diff --git a/source/opt/mem_pass.cpp b/source/opt/mem_pass.cpp
index 9292c358..41c29d64 100644
--- a/source/opt/mem_pass.cpp
+++ b/source/opt/mem_pass.cpp
@@ -178,7 +178,7 @@ void MemPass::AddStores(uint32_t ptr_id, std::queue<Instruction*>* insts) {
}
void MemPass::DCEInst(Instruction* inst,
- const function<void(Instruction*)>& call_back) {
+ const std::function<void(Instruction*)>& call_back) {
std::queue<Instruction*> deadInsts;
deadInsts.push(inst);
while (!deadInsts.empty()) {
@@ -310,7 +310,7 @@ bool MemPass::IsTargetVar(uint32_t varId) {
// [ ... ]
// %30 = OpPhi %int %int_42 %13 %50 %14 %50 %15
void MemPass::RemovePhiOperands(
- Instruction* phi, const unordered_set<BasicBlock*>& reachable_blocks) {
+ Instruction* phi, const std::unordered_set<BasicBlock*>& reachable_blocks) {
std::vector<Operand> keep_operands;
uint32_t type_id = 0;
// The id of an undefined value we've generated.
diff --git a/source/val/basic_block.cpp b/source/val/basic_block.cpp
index d70a3f00..ce1a3b51 100644
--- a/source/val/basic_block.cpp
+++ b/source/val/basic_block.cpp
@@ -18,8 +18,6 @@
#include <utility>
#include <vector>
-using std::vector;
-
namespace spvtools {
namespace val {
@@ -55,7 +53,8 @@ BasicBlock* BasicBlock::immediate_post_dominator() {
return immediate_post_dominator_;
}
-void BasicBlock::RegisterSuccessors(const vector<BasicBlock*>& next_blocks) {
+void BasicBlock::RegisterSuccessors(
+ const std::vector<BasicBlock*>& next_blocks) {
for (auto& block : next_blocks) {
block->predecessors_.push_back(this);
successors_.push_back(block);
diff --git a/source/val/function.cpp b/source/val/function.cpp
index 9f02a489..d1599b71 100644
--- a/source/val/function.cpp
+++ b/source/val/function.cpp
@@ -27,13 +27,6 @@
#include "val/construct.h"
#include "validate.h"
-using std::ignore;
-using std::list;
-using std::make_pair;
-using std::pair;
-using std::tie;
-using std::vector;
-
namespace spvtools {
namespace val {
@@ -140,12 +133,12 @@ spv_result_t Function::RegisterBlock(uint32_t block_id, bool is_definition) {
return SPV_SUCCESS;
}
-void Function::RegisterBlockEnd(vector<uint32_t> next_list,
+void Function::RegisterBlockEnd(std::vector<uint32_t> next_list,
SpvOp branch_instruction) {
assert(
current_block_ &&
"RegisterBlockEnd can only be called when parsing a binary in a block");
- vector<BasicBlock*> next_blocks;
+ std::vector<BasicBlock*> next_blocks;
next_blocks.reserve(next_list.size());
std::unordered_map<uint32_t, BasicBlock>::iterator inserted_block;
@@ -196,16 +189,18 @@ size_t Function::undefined_block_count() const {
return undefined_blocks_.size();
}
-const vector<BasicBlock*>& Function::ordered_blocks() const {
+const std::vector<BasicBlock*>& Function::ordered_blocks() const {
return ordered_blocks_;
}
-vector<BasicBlock*>& Function::ordered_blocks() { return ordered_blocks_; }
+std::vector<BasicBlock*>& Function::ordered_blocks() { return ordered_blocks_; }
const BasicBlock* Function::current_block() const { return current_block_; }
BasicBlock* Function::current_block() { return current_block_; }
-const list<Construct>& Function::constructs() const { return cfg_constructs_; }
-list<Construct>& Function::constructs() { return cfg_constructs_; }
+const std::list<Construct>& Function::constructs() const {
+ return cfg_constructs_;
+}
+std::list<Construct>& Function::constructs() { return cfg_constructs_; }
const BasicBlock* Function::first_block() const {
if (ordered_blocks_.empty()) return nullptr;
@@ -219,30 +214,31 @@ BasicBlock* Function::first_block() {
bool Function::IsBlockType(uint32_t merge_block_id, BlockType type) const {
bool ret = false;
const BasicBlock* block;
- tie(block, ignore) = GetBlock(merge_block_id);
+ std::tie(block, std::ignore) = GetBlock(merge_block_id);
if (block) {
ret = block->is_type(type);
}
return ret;
}
-pair<const BasicBlock*, bool> Function::GetBlock(uint32_t block_id) const {
+std::pair<const BasicBlock*, bool> Function::GetBlock(uint32_t block_id) const {
const auto b = blocks_.find(block_id);
if (b != end(blocks_)) {
const BasicBlock* block = &(b->second);
bool defined =
- undefined_blocks_.find(block->id()) == end(undefined_blocks_);
- return make_pair(block, defined);
+ undefined_blocks_.find(block->id()) == std::end(undefined_blocks_);
+ return std::make_pair(block, defined);
} else {
- return make_pair(nullptr, false);
+ return std::make_pair(nullptr, false);
}
}
-pair<BasicBlock*, bool> Function::GetBlock(uint32_t block_id) {
+std::pair<BasicBlock*, bool> Function::GetBlock(uint32_t block_id) {
const BasicBlock* out;
bool defined;
- tie(out, defined) = const_cast<const Function*>(this)->GetBlock(block_id);
- return make_pair(const_cast<BasicBlock*>(out), defined);
+ std::tie(out, defined) =
+ const_cast<const Function*>(this)->GetBlock(block_id);
+ return std::make_pair(const_cast<BasicBlock*>(out), defined);
}
Function::GetBlocksFunction Function::AugmentedCFGSuccessorsFunction() const {
diff --git a/source/val/instruction.cpp b/source/val/instruction.cpp
index 1e2bb76a..692ba1a2 100644
--- a/source/val/instruction.cpp
+++ b/source/val/instruction.cpp
@@ -16,8 +16,6 @@
#include <utility>
-using std::make_pair;
-
namespace spvtools {
namespace val {
@@ -47,7 +45,7 @@ Instruction::Instruction(const spv_parsed_instruction_t* inst,
uses_() {}
void Instruction::RegisterUse(const Instruction* inst, uint32_t index) {
- uses_.push_back(make_pair(inst, index));
+ uses_.push_back(std::make_pair(inst, index));
}
} // namespace val
diff --git a/source/val/validate.cpp b/source/val/validate.cpp
index 74627a22..7c586c36 100644
--- a/source/val/validate.cpp
+++ b/source/val/validate.cpp
@@ -42,14 +42,6 @@
#include "source/val/validation_state.h"
#include "spirv-tools/libspirv.h"
-using std::function;
-using std::ostream_iterator;
-using std::string;
-using std::stringstream;
-using std::transform;
-using std::vector;
-using std::placeholders::_1;
-
namespace spvtools {
namespace val {
namespace {
@@ -165,7 +157,7 @@ spv_result_t ProcessInstruction(void* user_data,
}
void printDot(const ValidationState_t& _, const BasicBlock& other) {
- string block_string;
+ std::string block_string;
if (other.successors()->empty()) {
block_string += "end ";
} else {
@@ -199,7 +191,7 @@ void PrintBlocks(ValidationState_t& _, Function func) {
UNUSED(void PrintDotGraph(ValidationState_t& _, Function func)) {
if (func.first_block()) {
- string func_name(_.getIdOrName(func.id()));
+ std::string func_name(_.getIdOrName(func.id()));
printf("digraph %s {\n", func_name.c_str());
PrintBlocks(_, func);
printf("}\n");
@@ -261,11 +253,13 @@ spv_result_t ValidateBinaryUsingContextAndValidationState(
// module. Use the information from the ProcessInstruction pass to make the
// checks.
if (vstate->unresolved_forward_id_count() > 0) {
- stringstream ss;
- vector<uint32_t> ids = vstate->UnresolvedForwardIds();
+ std::stringstream ss;
+ std::vector<uint32_t> ids = vstate->UnresolvedForwardIds();
- transform(begin(ids), end(ids), ostream_iterator<string>(ss, " "),
- bind(&ValidationState_t::getIdName, std::ref(*vstate), _1));
+ transform(std::begin(ids), std::end(ids),
+ std::ostream_iterator<std::string>(ss, " "),
+ bind(&ValidationState_t::getIdName, std::ref(*vstate),
+ std::placeholders::_1));
auto id_str = ss.str();
return vstate->diag(SPV_ERROR_INVALID_ID, nullptr)
diff --git a/source/val/validate_cfg.cpp b/source/val/validate_cfg.cpp
index 9ed45046..e369d06e 100644
--- a/source/val/validate_cfg.cpp
+++ b/source/val/validate_cfg.cpp
@@ -33,22 +33,6 @@
#include "source/val/function.h"
#include "source/val/validation_state.h"
-using std::find;
-using std::function;
-using std::get;
-using std::ignore;
-using std::make_pair;
-using std::make_tuple;
-using std::numeric_limits;
-using std::pair;
-using std::string;
-using std::tie;
-using std::transform;
-using std::tuple;
-using std::unordered_map;
-using std::unordered_set;
-using std::vector;
-
namespace spvtools {
namespace val {
@@ -86,13 +70,14 @@ spv_result_t MergeBlockAssert(ValidationState_t& _, uint32_t merge_block) {
/// Update the continue construct's exit blocks once the backedge blocks are
/// identified in the CFG.
void UpdateContinueConstructExitBlocks(
- Function& function, const vector<pair<uint32_t, uint32_t>>& back_edges) {
+ Function& function,
+ const std::vector<std::pair<uint32_t, uint32_t>>& back_edges) {
auto& constructs = function.constructs();
// TODO(umar): Think of a faster way to do this
for (auto& edge : back_edges) {
uint32_t back_edge_block_id;
uint32_t loop_header_block_id;
- tie(back_edge_block_id, loop_header_block_id) = edge;
+ std::tie(back_edge_block_id, loop_header_block_id) = edge;
auto is_this_header = [=](Construct& c) {
return c.type() == ConstructType::kLoop &&
c.entry_block()->id() == loop_header_block_id;
@@ -105,15 +90,17 @@ void UpdateContinueConstructExitBlocks(
assert(continue_construct->type() == ConstructType::kContinue);
BasicBlock* back_edge_block;
- tie(back_edge_block, ignore) = function.GetBlock(back_edge_block_id);
+ std::tie(back_edge_block, std::ignore) =
+ function.GetBlock(back_edge_block_id);
continue_construct->set_exit(back_edge_block);
}
}
}
}
-tuple<string, string, string> ConstructNames(ConstructType type) {
- string construct_name, header_name, exit_name;
+std::tuple<std::string, std::string, std::string> ConstructNames(
+ ConstructType type) {
+ std::string construct_name, header_name, exit_name;
switch (type) {
case ConstructType::kSelection:
@@ -140,16 +127,16 @@ tuple<string, string, string> ConstructNames(ConstructType type) {
assert(1 == 0 && "Not defined type");
}
- return make_tuple(construct_name, header_name, exit_name);
+ return std::make_tuple(construct_name, header_name, exit_name);
}
/// Constructs an error message for construct validation errors
-string ConstructErrorString(const Construct& construct,
- const string& header_string,
- const string& exit_string,
- const string& dominate_text) {
- string construct_name, header_name, exit_name;
- tie(construct_name, header_name, exit_name) =
+std::string ConstructErrorString(const Construct& construct,
+ const std::string& header_string,
+ const std::string& exit_string,
+ const std::string& dominate_text) {
+ std::string construct_name, header_name, exit_name;
+ std::tie(construct_name, header_name, exit_name) =
ConstructNames(construct.type());
// TODO(umar): Add header block for continue constructs to error message
@@ -319,7 +306,7 @@ spv_result_t StructuredSwitchChecks(const ValidationState_t& _,
spv_result_t StructuredControlFlowChecks(
const ValidationState_t& _, Function* function,
- const vector<pair<uint32_t, uint32_t>>& back_edges) {
+ const std::vector<std::pair<uint32_t, uint32_t>>& back_edges) {
/// Check all backedges target only loop headers and have exactly one
/// back-edge branching to it
@@ -328,7 +315,7 @@ spv_result_t StructuredControlFlowChecks(
for (auto back_edge : back_edges) {
uint32_t back_edge_block;
uint32_t header_block;
- tie(back_edge_block, header_block) = back_edge;
+ std::tie(back_edge_block, header_block) = back_edge;
if (!function->IsBlockType(header_block, kBlockTypeLoop)) {
return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(back_edge_block))
<< "Back-edges (" << _.getIdName(back_edge_block) << " -> "
@@ -358,8 +345,8 @@ spv_result_t StructuredControlFlowChecks(
auto merge = construct.exit_block();
if (header->reachable() && !merge) {
- string construct_name, header_name, exit_name;
- tie(construct_name, header_name, exit_name) =
+ std::string construct_name, header_name, exit_name;
+ std::tie(construct_name, header_name, exit_name) =
ConstructNames(construct.type());
return _.diag(SPV_ERROR_INTERNAL, _.FindDef(header->id()))
<< "Construct " + construct_name + " with " + header_name + " " +
@@ -403,8 +390,8 @@ spv_result_t StructuredControlFlowChecks(
if (block == header) continue;
for (auto pred : *block->predecessors()) {
if (pred->reachable() && !construct_blocks.count(pred)) {
- string construct_name, header_name, exit_name;
- tie(construct_name, header_name, exit_name) =
+ std::string construct_name, header_name, exit_name;
+ std::tie(construct_name, header_name, exit_name) =
ConstructNames(construct.type());
return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(pred->id()))
<< "block <ID> " << pred->id() << " branches to the "
@@ -431,7 +418,7 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) {
for (auto& function : _.functions()) {
// Check all referenced blocks are defined within a function
if (function.undefined_block_count() != 0) {
- string undef_blocks("{");
+ std::string undef_blocks("{");
bool first = true;
for (auto undefined_block : function.undefined_blocks()) {
undef_blocks += _.getIdName(undefined_block);
@@ -452,9 +439,9 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) {
// We want to analyze all the blocks in the function, even in degenerate
// control flow cases including unreachable blocks. So use the augmented
// CFG to ensure we cover all the blocks.
- vector<const BasicBlock*> postorder;
- vector<const BasicBlock*> postdom_postorder;
- vector<pair<uint32_t, uint32_t>> back_edges;
+ std::vector<const BasicBlock*> postorder;
+ std::vector<const BasicBlock*> postdom_postorder;
+ std::vector<std::pair<uint32_t, uint32_t>> back_edges;
auto ignore_block = [](const BasicBlock*) {};
auto ignore_edge = [](const BasicBlock*, const BasicBlock*) {};
if (!function.ordered_blocks().empty()) {
@@ -575,7 +562,7 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) {
} break;
case SpvOpSwitch: {
- vector<uint32_t> cases;
+ std::vector<uint32_t> cases;
for (size_t i = 1; i < inst->operands().size(); i += 2) {
uint32_t target = inst->GetOperandAs<uint32_t>(i);
CFG_ASSERT(FirstBlockAssert, target);
@@ -596,7 +583,7 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) {
case SpvOpKill:
case SpvOpReturnValue:
case SpvOpUnreachable:
- _.current_function().RegisterBlockEnd(vector<uint32_t>(), opcode);
+ _.current_function().RegisterBlockEnd(std::vector<uint32_t>(), opcode);
if (opcode == SpvOpKill) {
_.current_function().RegisterExecutionModelLimitation(
SpvExecutionModelFragment,
diff --git a/source/val/validate_decorations.cpp b/source/val/validate_decorations.cpp
index a539ea77..2f0d007d 100644
--- a/source/val/validate_decorations.cpp
+++ b/source/val/validate_decorations.cpp
@@ -30,8 +30,6 @@ namespace spvtools {
namespace val {
namespace {
-using std::make_pair;
-
// Distinguish between row and column major matrix layouts.
enum MatrixLayout { kRowMajor, kColumnMajor };
@@ -200,7 +198,8 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp,
for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size());
memberIdx < numMembers; ++memberIdx) {
const auto id = members[memberIdx];
- const auto& constraint = constraints[make_pair(member_id, memberIdx)];
+ const auto& constraint =
+ constraints[std::make_pair(member_id, memberIdx)];
baseAlignment = std::max(
baseAlignment,
getBaseAlignment(id, roundUp, constraint, constraints, vstate));
@@ -284,7 +283,7 @@ uint32_t getSize(uint32_t member_id, bool roundUp,
// This check depends on the fact that all members have offsets. This
// has been checked earlier in the flow.
assert(offset != 0xffffffff);
- const auto& constraint = constraints[make_pair(lastMember, lastIdx)];
+ const auto& constraint = constraints[std::make_pair(lastMember, lastIdx)];
return offset +
getSize(lastMember, roundUp, constraint, constraints, vstate);
}
@@ -390,7 +389,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str,
const auto offset = member_offset.offset;
auto id = members[member_offset.member];
const LayoutConstraints& constraint =
- constraints[make_pair(struct_id, uint32_t(memberIdx))];
+ constraints[std::make_pair(struct_id, uint32_t(memberIdx))];
const auto alignment =
getBaseAlignment(id, blockRules, constraint, constraints, vstate);
const auto inst = vstate.FindDef(id);
@@ -718,7 +717,7 @@ void ComputeMemberConstraintsForStruct(MemberConstraints* constraints,
for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size());
memberIdx < numMembers; memberIdx++) {
LayoutConstraints& constraint =
- (*constraints)[make_pair(struct_id, memberIdx)];
+ (*constraints)[std::make_pair(struct_id, memberIdx)];
constraint = inherited;
for (auto& decoration : vstate.id_decorations(struct_id)) {
if (decoration.struct_member_index() == (int)memberIdx) {
diff --git a/source/val/validate_id.cpp b/source/val/validate_id.cpp
index 6cc1a5c8..d00cef55 100644
--- a/source/val/validate_id.cpp
+++ b/source/val/validate_id.cpp
@@ -34,13 +34,6 @@
#include "source/val/validation_state.h"
#include "spirv-tools/libspirv.h"
-using std::function;
-using std::ignore;
-using std::make_pair;
-using std::pair;
-using std::unordered_set;
-using std::vector;
-
namespace spvtools {
namespace val {
namespace {
@@ -50,8 +43,9 @@ class idUsage {
idUsage(spv_const_context context, const spv_instruction_t* pInsts,
const uint64_t instCountArg, const SpvMemoryModel memoryModelArg,
const SpvAddressingModel addressingModelArg,
- const ValidationState_t& module, const vector<uint32_t>& entry_points,
- spv_position positionArg, const MessageConsumer& consumer)
+ const ValidationState_t& module,
+ const std::vector<uint32_t>& entry_points, spv_position positionArg,
+ const MessageConsumer& consumer)
: targetEnv(context->target_env),
opcodeTable(context->opcode_table),
operandTable(context->operand_table),
@@ -82,7 +76,7 @@ class idUsage {
spv_position position;
const MessageConsumer& consumer_;
const ValidationState_t& module_;
- vector<uint32_t> entry_points_;
+ std::vector<uint32_t> entry_points_;
// Returns true if the two instructions represent structs that, as far as the
// validator can tell, have the exact same data layout.
@@ -101,8 +95,8 @@ class idUsage {
bool HaveSameLayoutDecorations(const Instruction* type1,
const Instruction* type2);
bool HasConflictingMemberOffsets(
- const vector<Decoration>& type1_decorations,
- const vector<Decoration>& type2_decorations) const;
+ const std::vector<Decoration>& type1_decorations,
+ const std::vector<Decoration>& type2_decorations) const;
};
#define DIAG(inst) \
@@ -367,8 +361,8 @@ bool idUsage::isValid<SpvOpTypeSampler>(const spv_instruction_t*,
// constant-defining instruction (either OpConstant or
// OpSpecConstant). typeWords are the words of the constant's-type-defining
// OpTypeInt.
-bool aboveZero(const vector<uint32_t>& constWords,
- const vector<uint32_t>& typeWords) {
+bool aboveZero(const std::vector<uint32_t>& constWords,
+ const std::vector<uint32_t>& typeWords) {
const uint32_t width = typeWords[2];
const bool is_signed = typeWords[3] > 0;
const uint32_t loWord = constWords[3];
@@ -807,7 +801,7 @@ bool idUsage::isValid<SpvOpConstantSampler>(const spv_instruction_t* inst,
// True if instruction defines a type that can have a null value, as defined by
// the SPIR-V spec. Tracks composite-type components through module to check
// nullability transitively.
-bool IsTypeNullable(const vector<uint32_t>& instruction,
+bool IsTypeNullable(const std::vector<uint32_t>& instruction,
const ValidationState_t& module) {
uint16_t opcode;
uint16_t word_count;
@@ -2009,8 +2003,8 @@ bool idUsage::HaveSameLayoutDecorations(const Instruction* type1,
}
bool idUsage::HasConflictingMemberOffsets(
- const vector<Decoration>& type1_decorations,
- const vector<Decoration>& type2_decorations) const {
+ const std::vector<Decoration>& type1_decorations,
+ const std::vector<Decoration>& type2_decorations) const {
{
// We are interested in conflicting decoration. If a decoration is in one
// list but not the other, then we will assume the code is correct. We are
@@ -2071,7 +2065,7 @@ spv_result_t UpdateIdUse(ValidationState_t& _) {
/// NOTE: This function does NOT check module scoped functions which are
/// checked during the initial binary parse in the IdPass below
spv_result_t CheckIdDefinitionDominateUse(const ValidationState_t& _) {
- unordered_set<const Instruction*> phi_instructions;
+ std::unordered_set<const Instruction*> phi_instructions;
for (const auto& definition : _.all_definitions()) {
// Check only those definitions defined in a function
if (const Function* func = definition.second->function()) {
diff --git a/source/val/validation_state.cpp b/source/val/validation_state.cpp
index 4b17732e..8db20fe9 100644
--- a/source/val/validation_state.cpp
+++ b/source/val/validation_state.cpp
@@ -242,7 +242,7 @@ std::string ValidationState_t::getIdName(uint32_t id) const {
std::string ValidationState_t::getIdOrName(uint32_t id) const {
std::stringstream out;
- if (operand_names_.find(id) != end(operand_names_)) {
+ if (operand_names_.find(id) != std::end(operand_names_)) {
out << operand_names_.at(id);
} else {
out << id;
@@ -261,7 +261,7 @@ std::vector<uint32_t> ValidationState_t::UnresolvedForwardIds() const {
}
bool ValidationState_t::IsDefinedId(uint32_t id) const {
- return all_definitions_.find(id) != end(all_definitions_);
+ return all_definitions_.find(id) != std::end(all_definitions_);
}
const Instruction* ValidationState_t::FindDef(uint32_t id) const {