Rename SpvTools to SpirvTools.
diff --git a/source/opt/build_module.cpp b/source/opt/build_module.cpp
index ba4d1f3..1a4bc37 100644
--- a/source/opt/build_module.cpp
+++ b/source/opt/build_module.cpp
@@ -64,7 +64,7 @@
std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
MessageConsumer consumer,
const std::string& text) {
- SpvTools t(env);
+ SpirvTools t(env);
t.SetMessageConsumer(consumer);
std::vector<uint32_t> binary;
if (!t.Assemble(text, &binary)) return nullptr;
diff --git a/source/opt/libspirv.cpp b/source/opt/libspirv.cpp
index b3f89f1..fe09ed5 100644
--- a/source/opt/libspirv.cpp
+++ b/source/opt/libspirv.cpp
@@ -22,7 +22,7 @@
namespace spvtools {
// Structs for holding the data members for SpvTools.
-struct SpvTools::Impl {
+struct SpirvTools::Impl {
explicit Impl(spv_target_env env) : context(spvContextCreate(env)) {
// The default consumer in spv_context_t is a null consumer, which provides
// equivalent functionality (from the user's perspective) as a real consumer
@@ -33,16 +33,16 @@
spv_context context; // C interface context object.
};
-SpvTools::SpvTools(spv_target_env env) : impl_(new Impl(env)) {}
+SpirvTools::SpirvTools(spv_target_env env) : impl_(new Impl(env)) {}
-SpvTools::~SpvTools() {}
+SpirvTools::~SpirvTools() {}
-void SpvTools::SetMessageConsumer(MessageConsumer consumer) {
+void SpirvTools::SetMessageConsumer(MessageConsumer consumer) {
SetContextMessageConsumer(impl_->context, std::move(consumer));
}
-bool SpvTools::Assemble(const std::string& text,
- std::vector<uint32_t>* binary) const {
+bool SpirvTools::Assemble(const std::string& text,
+ std::vector<uint32_t>* binary) const {
spv_binary spvbinary = nullptr;
spv_result_t status = spvTextToBinary(impl_->context, text.data(),
text.size(), &spvbinary, nullptr);
@@ -53,8 +53,8 @@
return status == SPV_SUCCESS;
}
-bool SpvTools::Disassemble(const std::vector<uint32_t>& binary,
- std::string* text, uint32_t options) const {
+bool SpirvTools::Disassemble(const std::vector<uint32_t>& binary,
+ std::string* text, uint32_t options) const {
spv_text spvtext = nullptr;
spv_result_t status = spvBinaryToText(
impl_->context, binary.data(), binary.size(), options, &spvtext, nullptr);
@@ -65,7 +65,7 @@
return status == SPV_SUCCESS;
}
-bool SpvTools::Validate(const std::vector<uint32_t>& binary) const {
+bool SpirvTools::Validate(const std::vector<uint32_t>& binary) const {
spv_const_binary_t b = {binary.data(), binary.size()};
return spvValidate(impl_->context, &b, nullptr) == SPV_SUCCESS;
}
diff --git a/source/opt/libspirv.hpp b/source/opt/libspirv.hpp
index 63dde2f..ab18f14 100644
--- a/source/opt/libspirv.hpp
+++ b/source/opt/libspirv.hpp
@@ -29,7 +29,7 @@
// provides methods for assembling, disassembling, and validating.
//
// Instances of this class provide basic thread-safety guarantee.
-class SpvTools {
+class SpirvTools {
public:
enum {
// Default disassembling option used by Disassemble():
@@ -44,16 +44,16 @@
// The constructed instance will have an empty message consumer, which just
// ignores all messages from the library. Use SetMessageConsumer() to supply
// one if messages are of concern.
- explicit SpvTools(spv_target_env env);
+ explicit SpirvTools(spv_target_env env);
// Disables copy/move constructor/assignment operations.
- SpvTools(const SpvTools&) = delete;
- SpvTools(SpvTools&&) = delete;
- SpvTools& operator=(const SpvTools&) = delete;
- SpvTools& operator=(SpvTools&&) = delete;
+ SpirvTools(const SpirvTools&) = delete;
+ SpirvTools(SpirvTools&&) = delete;
+ SpirvTools& operator=(const SpirvTools&) = delete;
+ SpirvTools& operator=(SpirvTools&&) = delete;
// Destructs this instance.
- ~SpvTools();
+ ~SpirvTools();
// Sets the message consumer to the given |consumer|. The |consumer| will be
// invoked once for each message communicated from the library.
diff --git a/test/cpp_interface.cpp b/test/cpp_interface.cpp
index 7c49048..b7ca5b7 100644
--- a/test/cpp_interface.cpp
+++ b/test/cpp_interface.cpp
@@ -25,7 +25,7 @@
TEST(CppInterface, SuccessfulRoundTrip) {
const std::string input_text = "%2 = OpSizeOf %1 %3\n";
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> binary;
EXPECT_TRUE(t.Assemble(input_text, &binary));
@@ -52,7 +52,7 @@
TEST(CppInterface, AssembleEmptyModule) {
std::vector<uint32_t> binary(10, 42);
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
EXPECT_TRUE(t.Assemble("", &binary));
// We only have the header.
EXPECT_EQ(5u, binary.size());
@@ -62,7 +62,7 @@
TEST(CppInterface, AssembleWithWrongTargetEnv) {
const std::string input_text = "%r = OpSizeOf %type %pointer";
- SpvTools t(SPV_ENV_UNIVERSAL_1_0);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_0);
int invocation_count = 0;
t.SetMessageConsumer(
[&invocation_count](spv_message_level_t level, const char* source,
@@ -84,7 +84,7 @@
TEST(CppInterface, DisassembleEmptyModule) {
std::string text(10, 'x');
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
int invocation_count = 0;
t.SetMessageConsumer(
[&invocation_count](spv_message_level_t level, const char* source,
@@ -104,8 +104,8 @@
TEST(CppInterface, DisassembleWithWrongTargetEnv) {
const std::string input_text = "%r = OpSizeOf %type %pointer";
- SpvTools t11(SPV_ENV_UNIVERSAL_1_1);
- SpvTools t10(SPV_ENV_UNIVERSAL_1_0);
+ SpirvTools t11(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t10(SPV_ENV_UNIVERSAL_1_0);
int invocation_count = 0;
t10.SetMessageConsumer(
[&invocation_count](spv_message_level_t level, const char* source,
@@ -130,7 +130,7 @@
TEST(CppInterface, SuccessfulValidation) {
const std::string input_text =
"OpCapability Shader\nOpMemoryModel Logical GLSL450";
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
int invocation_count = 0;
t.SetMessageConsumer([&invocation_count](spv_message_level_t, const char*,
const spv_position_t&, const char*) {
@@ -144,7 +144,7 @@
}
TEST(CppInterface, ValidateEmptyModule) {
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
int invocation_count = 0;
t.SetMessageConsumer(
[&invocation_count](spv_message_level_t level, const char* source,
@@ -165,7 +165,7 @@
// source code, we can get the given |optimized| source code.
void CheckOptimization(const char* original, const char* optimized,
const Optimizer& opt) {
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> original_binary;
ASSERT_TRUE(t.Assemble(original, &original_binary));
@@ -179,7 +179,7 @@
}
TEST(CppInterface, OptimizeEmptyModule) {
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> binary;
EXPECT_TRUE(t.Assemble("", &binary));
@@ -246,7 +246,7 @@
}
TEST(CppInterface, OptimizeSameAddressForOriginalOptimizedBinary) {
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> binary;
ASSERT_TRUE(t.Assemble("OpSource GLSL 450", &binary));
diff --git a/test/opt/pass_fixture.h b/test/opt/pass_fixture.h
index 08a78dc..dedd356 100644
--- a/test/opt/pass_fixture.h
+++ b/test/opt/pass_fixture.h
@@ -134,7 +134,7 @@
private:
MessageConsumer consumer_; // Message consumer.
- SpvTools tools_; // An instance for calling SPIRV-Tools functionalities.
+ SpirvTools tools_; // An instance for calling SPIRV-Tools functionalities.
std::unique_ptr<opt::PassManager> manager_; // The pass manager.
};
diff --git a/test/opt/test_def_use.cpp b/test/opt/test_def_use.cpp
index 9d9089c..6e2af62 100644
--- a/test/opt/test_def_use.cpp
+++ b/test/opt/test_def_use.cpp
@@ -32,7 +32,7 @@
// Disassembles the given |inst| and returns the disassembly.
std::string DisassembleInst(ir::Instruction* inst) {
- SpvTools tools(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools tools(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> binary;
// We need this to generate the necessary header in the binary.
@@ -491,7 +491,7 @@
// Disassembles the given |module| and returns the disassembly.
std::string DisassembleModule(ir::Module* module) {
- SpvTools tools(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools tools(SPV_ENV_UNIVERSAL_1_1);
std::vector<uint32_t> binary;
module->ToBinary(&binary, /* skip_nop = */ false);
diff --git a/test/opt/test_ir_loader.cpp b/test/opt/test_ir_loader.cpp
index b989380..4ef49bd 100644
--- a/test/opt/test_ir_loader.cpp
+++ b/test/opt/test_ir_loader.cpp
@@ -23,7 +23,7 @@
using namespace spvtools;
void DoRoundTripCheck(const std::string& text) {
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::unique_ptr<ir::Module> module =
BuildModule(SPV_ENV_UNIVERSAL_1_1, IgnoreMessage, text);
ASSERT_NE(nullptr, module) << "Failed to assemble\n" << text;
@@ -210,7 +210,7 @@
"%double = OpTypeFloat 64\n";
// clang-format on
- SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+ SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
std::unique_ptr<ir::Module> module =
BuildModule(SPV_ENV_UNIVERSAL_1_1, IgnoreMessage, text);
ASSERT_NE(nullptr, module);