WebKit Bugzilla
Attachment 373279 Details for
Bug 199389
: [WHLSL] the initializer in VariableDeclaration should be a std::unique_ptr, not Optional<UniqueRef<..>>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch199389 (text/plain), 30.87 KB, created by
Robin Morisset
on 2019-07-01 17:01:45 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Robin Morisset
Created:
2019-07-01 17:01:45 PDT
Size:
30.87 KB
patch
obsolete
>diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index c2f305e7700..f5999c1529b 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,13 @@ >+2019-07-01 Robin Morisset <rmorisset@apple.com> >+ >+ [WHLSL] the initializer in VariableDeclaration should be a std::unique_ptr, not Optional<UniqueRef<..>> >+ https://bugs.webkit.org/show_bug.cgi?id=199389 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/UniqueRef.h: >+ (WTF::UniqueRef::moveToUniquePtr): Added. >+ > 2019-07-01 Philippe Normand <pnormand@igalia.com> > > [GStreamer] Cannot play Bert's Bytes radio stream from http://radio.dos.nl/ >diff --git a/Source/WTF/wtf/UniqueRef.h b/Source/WTF/wtf/UniqueRef.h >index 2039950d9d8..d6d639afb5b 100644 >--- a/Source/WTF/wtf/UniqueRef.h >+++ b/Source/WTF/wtf/UniqueRef.h >@@ -60,6 +60,8 @@ public: > operator T&() { ASSERT(m_ref); return *m_ref; } > operator const T&() const { ASSERT(m_ref); return *m_ref; } > >+ std::unique_ptr<T> moveToUniquePtr() { return WTFMove(m_ref); } >+ > private: > template<class U, class... Args> friend UniqueRef<U> makeUniqueRef(Args&&...); > template<class U> friend class UniqueRef; >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fb36b4877b8..dfe9b814ab1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2019-07-01 Robin Morisset <rmorisset@apple.com> >+ >+ [WHLSL] the initializer in VariableDeclaration should be a std::unique_ptr, not Optional<UniqueRef<..>> >+ https://bugs.webkit.org/show_bug.cgi?id=199389 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Optional<UniqueRef<..>> is not only semantically weird (UniqueRef is basically a unique_ptr that promises not to be null), but also inefficient, wasting 8 bytes for the boolean in Optional. >+ It is a pattern that appears throughout the AST. In this patch I start by removing it in a fairly simple spot: the initializer for VariableDeclaration. >+ >+ No test because there is no intended functional change. >+ >+ * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: >+ (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration): >+ (WebCore::WHLSL::AST::VariableDeclaration::initializer): >+ (WebCore::WHLSL::AST::VariableDeclaration::takeInitializer): >+ (WebCore::WHLSL::AST::VariableDeclaration::setInitializer): >+ * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp: >+ (WebCore::WHLSL::AutoInitialize::visit): >+ * Modules/webgpu/WHLSL/WHLSLChecker.cpp: >+ (WebCore::WHLSL::resolveWithOperatorAnderIndexer): >+ (WebCore::WHLSL::resolveWithOperatorLength): >+ (WebCore::WHLSL::resolveWithReferenceComparator): >+ * Modules/webgpu/WHLSL/WHLSLParser.cpp: >+ (WebCore::WHLSL::Parser::parseParameter): >+ (WebCore::WHLSL::Parser::parseVariableDeclaration): >+ * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: >+ * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: >+ (WebCore::WHLSL::wrapAnderCallArgument): >+ (WebCore::WHLSL::modify): >+ (WebCore::WHLSL::PropertyResolver::visit): >+ * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: >+ (WebCore::WHLSL::synthesizeArrayOperatorLength): >+ * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: >+ (WebCore::WHLSL::synthesizeConstructors): >+ * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: >+ (WebCore::WHLSL::synthesizeEnumerationFunctions): >+ * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp: >+ (WebCore::WHLSL::synthesizeStructureAccessors): >+ > 2019-07-01 Wenson Hsieh <wenson_hsieh@apple.com> > > iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h >index ede2b6e44d1..45e3cfa702a 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h >@@ -118,8 +118,8 @@ private: > ReadModifyWriteExpression(Lexer::Token&& origin, UniqueRef<Expression> leftValue) > : Expression(Lexer::Token(origin)) > , m_leftValue(WTFMove(leftValue)) >- , m_oldValue(makeUniqueRef<VariableDeclaration>(Lexer::Token(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, WTF::nullopt)) >- , m_newValue(makeUniqueRef<VariableDeclaration>(WTFMove(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, WTF::nullopt)) >+ , m_oldValue(makeUniqueRef<VariableDeclaration>(Lexer::Token(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, nullptr)) >+ , m_newValue(makeUniqueRef<VariableDeclaration>(WTFMove(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, nullptr)) > { > } > >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h >index 37ea38649cc..be0a058a1fc 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h >@@ -47,7 +47,7 @@ namespace AST { > class VariableDeclaration : public Value { > using Base = Value; > public: >- VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, Optional<UniqueRef<UnnamedType>>&& type, String&& name, Optional<Semantic>&& semantic, Optional<UniqueRef<Expression>>&& initializer) >+ VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, Optional<UniqueRef<UnnamedType>>&& type, String&& name, Optional<Semantic>&& semantic, std::unique_ptr<Expression>&& initializer) > : Base(WTFMove(origin)) > , m_qualifiers(WTFMove(qualifiers)) > , m_type(WTFMove(type)) >@@ -75,12 +75,13 @@ public: > const Optional<UniqueRef<UnnamedType>>& type() const { return m_type; } > UnnamedType* type() { return m_type ? &*m_type : nullptr; } > Optional<Semantic>& semantic() { return m_semantic; } >- Expression* initializer() { return m_initializer ? &*m_initializer : nullptr; } >+ Expression* initializer() { return m_initializer.get(); } > bool isAnonymous() const { return m_name.isNull(); } >- Optional<UniqueRef<Expression>> takeInitializer() { return WTFMove(m_initializer); } >- void setInitializer(UniqueRef<Expression> expression) >+ std::unique_ptr<Expression> takeInitializer() { return WTFMove(m_initializer); } >+ void setInitializer(std::unique_ptr<Expression> expression) > { > ASSERT(!initializer()); >+ ASSERT(expression); > m_initializer = WTFMove(expression); > } > >@@ -89,7 +90,7 @@ private: > Optional<UniqueRef<UnnamedType>> m_type; > String m_name; > Optional<Semantic> m_semantic; >- Optional<UniqueRef<Expression>> m_initializer; >+ std::unique_ptr<Expression> m_initializer; > }; > > using VariableDeclarations = Vector<UniqueRef<VariableDeclaration>>; >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp >index eab71b3f261..d11b907af3d 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp >@@ -69,7 +69,7 @@ private: > #else > String functionName = "<zero-init>"_s; > #endif >- auto callExpression = makeUniqueRef<AST::CallExpression>(variableDeclaration.origin(), WTFMove(functionName), Vector<UniqueRef<AST::Expression>>()); >+ auto callExpression = std::make_unique<AST::CallExpression>(variableDeclaration.origin(), WTFMove(functionName), Vector<UniqueRef<AST::Expression>>()); > callExpression->setType(type->clone()); > callExpression->setTypeAnnotation(AST::RightValue()); > callExpression->setOverloads(m_castFunctions); >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >index 98cd2ceb045..22bf60bc818 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >@@ -122,8 +122,8 @@ static AST::NativeFunctionDeclaration resolveWithOperatorAnderIndexer(Lexer::Tok > const bool isOperator = true; > auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(origin), firstArgument.addressSpace(), firstArgument.elementType().clone()); > AST::VariableDeclarations parameters; >- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, WTF::nullopt)); >- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType())), String(), WTF::nullopt, WTF::nullopt)); >+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, nullptr)); >+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType())), String(), WTF::nullopt, nullptr)); > return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator)); > } > >@@ -132,7 +132,7 @@ static AST::NativeFunctionDeclaration resolveWithOperatorLength(Lexer::Token ori > const bool isOperator = true; > auto returnType = AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType()); > AST::VariableDeclarations parameters; >- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, WTF::nullopt)); >+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, nullptr)); > return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator)); > } > >@@ -153,8 +153,8 @@ static AST::NativeFunctionDeclaration resolveWithReferenceComparator(Lexer::Toke > })); > })); > AST::VariableDeclarations parameters; >- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), argumentType->clone(), String(), WTF::nullopt, WTF::nullopt)); >- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, WTF::nullopt)); >+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), argumentType->clone(), String(), WTF::nullopt, nullptr)); >+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, nullptr)); > return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator)); > } > >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp >index 4fa5c6e65ee..75a0874f43d 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp >@@ -877,7 +877,7 @@ auto Parser::parseParameter() -> Expected<AST::VariableDeclaration, Error> > > PARSE(semantic, Semantic); > >- return AST::VariableDeclaration(WTFMove(*origin), WTFMove(qualifiers), { WTFMove(*type) }, WTFMove(name), WTFMove(*semantic), WTF::nullopt); >+ return AST::VariableDeclaration(WTFMove(*origin), WTFMove(qualifiers), { WTFMove(*type) }, WTFMove(name), WTFMove(*semantic), nullptr); > } > > auto Parser::parseParameters() -> Expected<AST::VariableDeclarations, Error> >@@ -1155,12 +1155,13 @@ auto Parser::parseVariableDeclaration(UniqueRef<AST::UnnamedType>&& type) -> Exp > CONSUME_TYPE(name, Identifier); > PARSE(semantic, Semantic); > >+ std::unique_ptr<AST::Expression> initializer = nullptr; > if (tryType(Lexer::Token::Type::EqualsSign)) { >- PARSE(initializer, PossibleTernaryConditional); >- return AST::VariableDeclaration(WTFMove(*origin), WTFMove(qualifiers), { WTFMove(type) }, name->stringView.toString(), WTFMove(*semantic), WTFMove(*initializer)); >+ PARSE(initializingExpression, PossibleTernaryConditional); >+ initializer = initializingExpression.value().moveToUniquePtr(); > } > >- return AST::VariableDeclaration(WTFMove(*origin), WTFMove(qualifiers), { WTFMove(type) }, name->stringView.toString(), WTFMove(*semantic), WTF::nullopt); >+ return AST::VariableDeclaration(WTFMove(*origin), WTFMove(qualifiers), { WTFMove(type) }, name->stringView.toString(), WTFMove(*semantic), WTFMove(initializer)); > } > > auto Parser::parseVariableDeclarations() -> Expected<AST::VariableDeclarationsStatement, Error> >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp >index fc7a4df1b50..fc754bbb2fb 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp >@@ -134,7 +134,7 @@ public: > bool isEntryPoint = !!functionDefinition.entryPointType(); > if (isEntryPoint) { > auto structVariableDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(), >- m_structType->clone(), String(), WTF::nullopt, WTF::nullopt); >+ m_structType->clone(), String(), WTF::nullopt, nullptr); > > auto structVariableReference = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(structVariableDeclaration)); > structVariableReference->setType(m_structType->clone()); >@@ -144,12 +144,12 @@ public: > structVariableDeclarations.append(WTFMove(structVariableDeclaration)); > auto structDeclarationStatement = makeUniqueRef<AST::VariableDeclarationsStatement>(functionDefinition.origin(), WTFMove(structVariableDeclarations)); > >- auto makePointerExpression = makeUniqueRef<AST::MakePointerExpression>(functionDefinition.origin(), WTFMove(structVariableReference)); >+ auto makePointerExpression = std::make_unique<AST::MakePointerExpression>(functionDefinition.origin(), WTFMove(structVariableReference)); > makePointerExpression->setType(m_pointerToStructType->clone()); > makePointerExpression->setTypeAnnotation(AST::RightValue()); > > auto pointerDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(), >- m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, Optional<UniqueRef<AST::Expression>>(WTFMove(makePointerExpression))); >+ m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, WTFMove(makePointerExpression)); > m_structVariable = &pointerDeclaration; > > AST::VariableDeclarations pointerVariableDeclarations; >@@ -160,7 +160,7 @@ public: > functionDefinition.block().statements().insert(1, WTFMove(pointerDeclarationStatement)); > } else { > auto pointerDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(), >- m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, WTF::nullopt); >+ m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, nullptr); > m_structVariable = &pointerDeclaration; > functionDefinition.parameters().append(WTFMove(pointerDeclaration)); > } >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp >index 0901264805f..17fb0954c7a 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp >@@ -108,7 +108,7 @@ static Optional<AnderCallArgumentResult> wrapAnderCallArgument(UniqueRef<AST::Ex > } > if (threadAnderFunction) { > auto origin = expression->origin(); >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), baseType->clone(), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), baseType->clone(), String(), WTF::nullopt, nullptr); > > auto variableReference1 = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(variableDeclaration)); > variableReference1->setType(baseType->clone()); >@@ -312,14 +312,14 @@ static Optional<ModifyResult> modify(AST::PropertyAccessExpression& propertyAcce > AST::Expression& innerLeftExpression = leftExpression; > > // Create "p" variable. >- auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(leftExpression->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(makeUniqueRef<AST::PointerType>(Lexer::Token(leftExpression->origin()), *leftExpression->typeAnnotation().leftAddressSpace(), leftExpression->resolvedType().clone())), String(), WTF::nullopt, WTF::nullopt); >+ auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(leftExpression->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(makeUniqueRef<AST::PointerType>(Lexer::Token(leftExpression->origin()), *leftExpression->typeAnnotation().leftAddressSpace(), leftExpression->resolvedType().clone())), String(), WTF::nullopt, nullptr); > > // Create "q" and "r" variables. > Vector<UniqueRef<AST::VariableDeclaration>> intermediateVariables; > intermediateVariables.reserveInitialCapacity(chain.size() - 1); > for (size_t i = 1; i < chain.size(); ++i) { > auto& propertyAccessExpression = static_cast<AST::PropertyAccessExpression&>(chain[i]); >- intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), WTF::nullopt, WTF::nullopt)); >+ intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), WTF::nullopt, nullptr)); > } > > // Consider a[foo()][b] = c; >@@ -350,7 +350,7 @@ static Optional<ModifyResult> modify(AST::PropertyAccessExpression& propertyAcce > continue; > } > auto& indexExpression = downcast<AST::IndexExpression>(propertyAccessExpression); >- indexVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), indexExpression.indexExpression().resolvedType().clone(), String(), WTF::nullopt, WTF::nullopt)); >+ indexVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), indexExpression.indexExpression().resolvedType().clone(), String(), WTF::nullopt, nullptr)); > } > > Vector<UniqueRef<AST::Expression>> expressions; >@@ -562,7 +562,7 @@ void PropertyResolver::visit(AST::ReadModifyWriteExpression& readModifyWriteExpr > auto baseType = readModifyWriteExpression.leftValue().resolvedType().clone(); > auto pointerType = makeUniqueRef<AST::PointerType>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), *readModifyWriteExpression.leftValue().typeAnnotation().leftAddressSpace(), baseType->clone()); > >- auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(pointerType->clone()), String(), WTF::nullopt, WTF::nullopt); >+ auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(pointerType->clone()), String(), WTF::nullopt, nullptr); > > Vector<UniqueRef<AST::Expression>> expressions; > >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp >index b584b9e44e9..9ad7fc50ea4 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp >@@ -65,7 +65,7 @@ bool synthesizeArrayOperatorLength(Program& program) > bool isOperator = true; > > for (auto& arrayType : arrayTypes) { >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(arrayType.get().origin()), AST::Qualifiers(), arrayType.get().clone(), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(arrayType.get().origin()), AST::Qualifiers(), arrayType.get().clone(), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(arrayType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(arrayType.get().origin()), program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp >index c522ea77d90..0031f99f985 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp >@@ -157,7 +157,7 @@ bool synthesizeConstructors(Program& program) > for (auto& unnamedTypeKey : unnamedTypes) { > auto& unnamedType = unnamedTypeKey.unnamedType(); > >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(unnamedType.origin()), AST::Qualifiers(), unnamedType.clone(), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(unnamedType.origin()), AST::Qualifiers(), unnamedType.clone(), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >@@ -174,7 +174,7 @@ bool synthesizeConstructors(Program& program) > if (is<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType)) && downcast<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType)).isAtomic()) > continue; > >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get())), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get())), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp >index d74af33a1f0..af74160dfcb 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp >@@ -41,8 +41,8 @@ bool synthesizeEnumerationFunctions(Program& program) > bool isOperator = true; > for (auto& enumerationDefinition : program.enumerationDefinitions()) { > { >- auto variableDeclaration1 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, WTF::nullopt); >- auto variableDeclaration2 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration1 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr); >+ auto variableDeclaration2 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration1)); > parameters.append(WTFMove(variableDeclaration2)); >@@ -52,7 +52,7 @@ bool synthesizeEnumerationFunctions(Program& program) > } > > { >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator.value"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >@@ -61,7 +61,7 @@ bool synthesizeEnumerationFunctions(Program& program) > } > > { >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >@@ -70,7 +70,7 @@ bool synthesizeEnumerationFunctions(Program& program) > } > > { >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), enumerationDefinition->type().clone(), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), enumerationDefinition->type().clone(), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp >index 3c0bc2b8c37..29a6fdb5cbf 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp >@@ -47,7 +47,7 @@ bool synthesizeStructureAccessors(Program& program) > // The ander: operator&.field > auto createAnder = [&](AST::AddressSpace addressSpace) -> AST::NativeFunctionDeclaration { > auto argumentType = makeUniqueRef<AST::PointerType>(Lexer::Token(structureElement.origin()), addressSpace, AST::TypeReference::wrap(Lexer::Token(structureElement.origin()), structureDefinition)); >- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(structureElement.origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, WTF::nullopt); >+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(structureElement.origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, nullptr); > AST::VariableDeclarations parameters; > parameters.append(WTFMove(variableDeclaration)); > auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(structureElement.origin()), addressSpace, structureElement.type().clone());
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199389
: 373279