Cleanup doc and lint warnings.
This CL fixes up several documentation and linter warnings.
Change-Id: Ic367ba1937f20dfe47a8c8e4035c17e8a3d0f2e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17880
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/reader/spirv/parser_impl_test_helper.h b/src/reader/spirv/parser_impl_test_helper.h
index 3e4b8d1..0838b00 100644
--- a/src/reader/spirv/parser_impl_test_helper.h
+++ b/src/reader/spirv/parser_impl_test_helper.h
@@ -17,6 +17,7 @@
#include <memory>
#include <string>
+#include <vector>
#include "gtest/gtest.h"
#include "src/context.h"
@@ -26,18 +27,24 @@
namespace reader {
namespace spirv {
+/// SPIR-V Parser test class
class SpvParserTest : public testing::Test {
public:
SpvParserTest() = default;
~SpvParserTest() = default;
+ /// Sets up the test helper
void SetUp() { ctx_.type_mgr = &tm_; }
+ /// Tears down the test helper
void TearDown() {
impl_ = nullptr;
ctx_.type_mgr = nullptr;
}
+ /// Retrieves the parser from the helper
+ /// @param input the string to parse
+ /// @returns the parser implementation
ParserImpl* parser(const std::vector<uint32_t>& input) {
impl_ = std::make_unique<ParserImpl>(ctx_, input);
return impl_.get();
@@ -53,4 +60,4 @@
} // namespace reader
} // namespace tint
-#endif // SRC_READER_WGSL_PARSER_IMPL_TEST_HELPER_H_
+#endif // SRC_READER_SPIRV_PARSER_IMPL_TEST_HELPER_H_
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index eb66cd2..1b71bea 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -372,7 +372,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return nullptr;
- if (name == "" || type == nullptr) {
+ if (name.empty() || type == nullptr) {
set_error(peek(), "error parsing constant variable identifier");
return nullptr;
}
@@ -593,7 +593,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return nullptr;
- if (name == "" || type == nullptr) {
+ if (name.empty() || type == nullptr) {
set_error(peek(), "invalid identifier declaration");
return nullptr;
}
@@ -1102,7 +1102,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return nullptr;
- if (name == "" || type == nullptr) {
+ if (name.empty() || type == nullptr) {
set_error(peek(), "invalid identifier declaration");
return nullptr;
}
@@ -1283,7 +1283,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return {};
- if (name == "" || type == nullptr)
+ if (name.empty() || type == nullptr)
return {};
for (;;) {
@@ -1300,7 +1300,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return {};
- if (name == "" || type == nullptr) {
+ if (name.empty() || type == nullptr) {
set_error(t, "found , but no variable declaration");
return {};
}
@@ -1683,7 +1683,7 @@
std::tie(name, type) = variable_ident_decl();
if (has_error())
return nullptr;
- if (name == "" || type == nullptr) {
+ if (name.empty() || type == nullptr) {
set_error(peek(), "unable to parse variable declaration");
return nullptr;
}
diff --git a/src/reader/wgsl/parser_impl_test_helper.h b/src/reader/wgsl/parser_impl_test_helper.h
index a0d2033..63f50cb 100644
--- a/src/reader/wgsl/parser_impl_test_helper.h
+++ b/src/reader/wgsl/parser_impl_test_helper.h
@@ -26,23 +26,31 @@
namespace reader {
namespace wgsl {
+/// WGSL Parser test class
class ParserImplTest : public testing::Test {
public:
+ /// Constructor
ParserImplTest() = default;
~ParserImplTest() = default;
+ /// Sets up the test helper
void SetUp() { ctx_.type_mgr = &tm_; }
+ /// Tears down the test helper
void TearDown() {
impl_ = nullptr;
ctx_.type_mgr = nullptr;
}
+ /// Retrieves the parser from the helper
+ /// @param str the string to parse
+ /// @returns the parser implementation
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(ctx_, str);
return impl_.get();
}
+ /// @returns the type manager
TypeManager* tm() { return &tm_; }
private: