tint/utils: Vector::Clear: disable "maybe initialized" warning

Bug: 1607
Change-Id: I0da8ff0ddfe8ff09b06268333f7d1cf0285b2eba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113060
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Jason Erb 2022-12-07 01:07:54 +00:00 committed by Dawn LUCI CQ
parent 8515312a08
commit 94751e1a7d
1 changed files with 3 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "src/tint/castable.h" #include "src/tint/castable.h"
#include "src/tint/traits.h" #include "src/tint/traits.h"
#include "src/tint/utils/bitcast.h" #include "src/tint/utils/bitcast.h"
#include "src/tint/utils/compiler_macros.h"
#include "src/tint/utils/string.h" #include "src/tint/utils/string.h"
namespace tint::utils { namespace tint::utils {
@ -395,10 +396,12 @@ class Vector {
/// Clears all elements from the vector, keeping the capacity the same. /// Clears all elements from the vector, keeping the capacity the same.
void Clear() { void Clear() {
TINT_BEGIN_DISABLE_WARNING(MAYBE_UNINITIALIZED);
for (size_t i = 0; i < impl_.slice.len; i++) { for (size_t i = 0; i < impl_.slice.len; i++) {
impl_.slice.data[i].~T(); impl_.slice.data[i].~T();
} }
impl_.slice.len = 0; impl_.slice.len = 0;
TINT_END_DISABLE_WARNING(MAYBE_UNINITIALIZED);
} }
/// Appends a new element to the vector. /// Appends a new element to the vector.