[webkit-changes] [WebKit/WebKit] 44decf: Add WTF::ReferenceWrapperVector

Tadeu Zagallo noreply at github.com
Fri Apr 28 00:26:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 44decfc45440d67616d1abe20f044de27c156535
      https://github.com/WebKit/WebKit/commit/44decfc45440d67616d1abe20f044de27c156535
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-04-28 (Fri, 28 Apr 2023)

  Changed paths:
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/CMakeLists.txt
    A Source/WTF/wtf/ReferenceWrapperVector.h
    M Source/WebGPU/WGSL/AST/ASTStructureMember.h
    M Source/WebGPU/WGSL/EntryPointRewriter.cpp
    M Source/WebGPU/WGSL/MangleNames.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  Add WTF::ReferenceWrapperVector
https://bugs.webkit.org/show_bug.cgi?id=256045
rdar://108610658

Reviewed by Myles C. Maxfield.

Similar to WTF::RefVector, add ReferenceWrapperVector<T>, which is a specialization
of Vector<std::reference_wrapper<T>> with convenience accessors and iterators. This
removes the need to use `.get()` when either accessing an element of the vector or
when using `auto&` to iterate over the vector. As a first use for the new vector I
replaced the use of Vector<std::reference_wrapper> in the WGSL compiler.

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/ReferenceWrapperVector.h: Added.
(WTF::ReferenceWrapperVectorIterator::ReferenceWrapperVectorIterator):
(WTF::ReferenceWrapperVectorIterator::operator* const):
(WTF::ReferenceWrapperVectorIterator::operator-> const):
(WTF::ReferenceWrapperVectorIterator::operator== const):
(WTF::ReferenceWrapperVectorIterator::operator!= const):
(WTF::ReferenceWrapperVectorIterator::operator++):
(WTF::ReferenceWrapperVectorIterator::operator--):
(WTF::ReferenceWrapperVectorConstIterator::ReferenceWrapperVectorConstIterator):
(WTF::ReferenceWrapperVectorConstIterator::operator* const):
(WTF::ReferenceWrapperVectorConstIterator::operator-> const):
(WTF::ReferenceWrapperVectorConstIterator::operator== const):
(WTF::ReferenceWrapperVectorConstIterator::operator!= const):
(WTF::ReferenceWrapperVectorConstIterator::operator++):
(WTF::ReferenceWrapperVectorConstIterator::operator--):
(WTF::ReferenceWrapperVector::begin):
(WTF::ReferenceWrapperVector::end):
(WTF::ReferenceWrapperVector::begin const):
(WTF::ReferenceWrapperVector::end const):
(WTF::ReferenceWrapperVector::rbegin):
(WTF::ReferenceWrapperVector::rend):
(WTF::ReferenceWrapperVector::rbegin const):
(WTF::ReferenceWrapperVector::rend const):
(WTF::ReferenceWrapperVector::at):
(WTF::ReferenceWrapperVector::at const):
(WTF::ReferenceWrapperVector::operator[]):
(WTF::ReferenceWrapperVector::operator[] const):
(WTF::ReferenceWrapperVector::first):
(WTF::ReferenceWrapperVector::first const):
(WTF::ReferenceWrapperVector::last):
(WTF::ReferenceWrapperVector::last const):
(WTF::ReferenceWrapperVector::containsIf const):
(WTF::inlineCapacity>::ReferenceWrapperVector):
(WTF::inlineCapacity>::findIf const):
* Source/WebGPU/WGSL/AST/ASTStructureMember.h:
* Source/WebGPU/WGSL/EntryPointRewriter.cpp:
(WGSL::EntryPointRewriter::visit):
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::visit):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitStructMembers):
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:

Canonical link: https://commits.webkit.org/263489@main




More information about the webkit-changes mailing list