mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 08:57:26 +00:00
tint/ast: Clean up StorageClass enum
Remove unused enum entries. Add a ParseStorageClass() function. Have the WGSL parser use this. First step to standardizing the way we parse enum-backed token sets. Change-Id: I31c02816493beeabda740ff43946edce097f5fd1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97148 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
ce8876074f
commit
48085845bd
@@ -15,6 +15,7 @@
|
||||
#ifndef SRC_TINT_UTILS_STRING_H_
|
||||
#define SRC_TINT_UTILS_STRING_H_
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace tint::utils {
|
||||
@@ -34,6 +35,15 @@ inline std::string ReplaceAll(std::string str,
|
||||
return str;
|
||||
}
|
||||
|
||||
/// @param value the value to be printed as a string
|
||||
/// @returns value printed as a string via the std::ostream `<<` operator
|
||||
template <typename T>
|
||||
std::string ToString(const T& value) {
|
||||
std::stringstream s;
|
||||
s << value;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
} // namespace tint::utils
|
||||
|
||||
#endif // SRC_TINT_UTILS_STRING_H_
|
||||
|
||||
@@ -32,5 +32,10 @@ TEST(StringTest, ReplaceAll) {
|
||||
ASSERT_EQ("aabxybbxybcc", ReplaceAll("aabbcc", "b", "bxyb"));
|
||||
}
|
||||
|
||||
TEST(StringTest, ToString) {
|
||||
ASSERT_EQ("123", ToString(123));
|
||||
ASSERT_EQ("hello", ToString("hello"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::utils
|
||||
|
||||
Reference in New Issue
Block a user