mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Make all ast and sem pointers const
And remove a whole load of const_cast hackery. Semantic nodes may contain internally mutable fields (although only ever modified during resolving), so these are always passed by `const` pointer. While all AST nodes are internally immutable, we have decided that pointers to AST nodes should also be marked `const`, for consistency. There's still a collection of const_cast calls in the Resolver. These will be fixed up in a later change. Bug: tint:745 Change-Id: I046309b8e586772605fc0fe6b2d27f28806d40ef Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66606 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
7d0fc07b20
commit
8648120bbe
@@ -32,7 +32,7 @@ struct CallTargetSignature {
|
||||
/// Constructor
|
||||
/// @param ret_ty the call target return type
|
||||
/// @param params the call target parameters
|
||||
CallTargetSignature(sem::Type* ret_ty, const ParameterList& params);
|
||||
CallTargetSignature(const sem::Type* ret_ty, const ParameterList& params);
|
||||
|
||||
/// Copy constructor
|
||||
CallTargetSignature(const CallTargetSignature&);
|
||||
@@ -41,9 +41,9 @@ struct CallTargetSignature {
|
||||
~CallTargetSignature();
|
||||
|
||||
/// The type of the call target return value
|
||||
sem::Type* const return_type = nullptr;
|
||||
const sem::Type* const return_type = nullptr;
|
||||
/// The parameters of the call target
|
||||
ParameterList const parameters;
|
||||
const ParameterList parameters;
|
||||
|
||||
/// Equality operator
|
||||
/// @param other the signature to compare this to
|
||||
@@ -62,7 +62,7 @@ class CallTarget : public Castable<CallTarget, Node> {
|
||||
/// Constructor
|
||||
/// @param return_type the return type of the call target
|
||||
/// @param parameters the parameters for the call target
|
||||
CallTarget(sem::Type* return_type, const ParameterList& parameters);
|
||||
CallTarget(const sem::Type* return_type, const ParameterList& parameters);
|
||||
|
||||
/// Copy constructor
|
||||
CallTarget(const CallTarget&);
|
||||
@@ -71,7 +71,7 @@ class CallTarget : public Castable<CallTarget, Node> {
|
||||
~CallTarget() override;
|
||||
|
||||
/// @return the return type of the call target
|
||||
sem::Type* ReturnType() const { return signature_.return_type; }
|
||||
const sem::Type* ReturnType() const { return signature_.return_type; }
|
||||
|
||||
/// @return the parameters of the call target
|
||||
const ParameterList& Parameters() const { return signature_.parameters; }
|
||||
|
||||
Reference in New Issue
Block a user