Commit Graph

19 Commits

Author SHA1 Message Date
Ben Clayton e6995de232 Add ProgramID feed it into all ast::Nodes
This will be used to detect accidental leaks of program objects between programs.

Bug: tint:709
Change-Id: I20f784a2c673d19a04a880b3ec91dfe2eb743bdb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47622
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-04-13 23:27:27 +00:00
Ben Clayton 5b36d2c612 Remove all unnecessary includes
All includes from .cc to .h are preserved, even when transitively included.

It's clear that there are far too many includes in header files, and we should be more aggressive with forward declarations. tint:532 will continue to track this work.

There are, however, plenty of includes that have accumulated over time which are no longer required directly or transitively, so this change starts with a clean slate of *required* includes.

Bug: tint:532
Change-Id: Ie1718dad565f8309fa180ef91bcf3920e76dba18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44042
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-03-09 11:11:17 +00:00
Ben Clayton 7732ca51c4 Rename TINT_INSTANTIATE_CLASS_ID()
to TINT_INSTANTIATE_TYPEINFO()

ClassID isn't a thing any more.

Change-Id: Ie1c0d4a95e58ef7166d3cab5ef733a2dfc702345
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42921
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-03-02 20:51:18 +00:00
Ben Clayton bbefff63a3 ast: Remove statement constructors that don't take a Source
Parsers need fixing up.

Bug: tint:396
Bug: tint:390
Change-Id: I137f1017ca56125cf3d52ecbef2ff46d0574338b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35161
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-12 11:58:44 +00:00
Ben Clayton 89ea705766 Add ClassID::Unique template and TINT_INSTANTIATE_CLASS_ID
We're seeing some chrome bots fail unittests in ways that suspiciously
look like dynamic casts are doing Wrong Things.

The ClassID::Of() logic depends on the linker folding away duplicate
compilation unit definitions based on ODR rules. If we were to somehow
end up with different definitions, then we'd have two or more different
ClassIDs for the same T type - leading to issues similar to what we're
seeing.

I'm not entirely sure why/how this could happen - and we've so far been
entirely unable to locally reproduce - but it _might_ have something to
do with the goma cache.

In an attempt to work around this, move the static symbol definition out
of a header-local-static and into the .cc file for each of the types.

Change-Id: If914d3045b9dac6fbe8824dac71153a768cfceb9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34563
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-12-02 18:19:28 +00:00
Ben Clayton 1d8098ae94 Replace Statement::(Is|As)* with Castable
Change-Id: I5520752a4b5844be0ecac7921616893d123b246a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34315
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton e319d7f0e9 Derive all ast::Node from Castable
The hand-rolled `AsBlah()`, `IsBlah()` methods will be migrated in future changes.

Change-Id: I078c100b561b50018771cc38c1cac4379c393424
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34301
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 54af8746ae wsgl parser: refactor statements()
Split out statments that are non-block (non-loops, etc) into a separate function.

These all end with a semi-colon, which is important for resynchronization on errors (coming up in another change).

Bug: tint:282
Change-Id: I0e58c4938f2bbe859dc6ffb8dcd45c8cf26101da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32281
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-11 14:11:55 +00:00
dan sinclair 775cb51794 [ast] Add BlockStatement
This CL adds a BlockStatement to wrap the statements in a given block.

Bug: tint:130
Change-Id: Idc2389e001d9d87ef7f45dcd8aa90bbd27ff7dce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25606
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-07-27 15:25:00 +00:00
dan sinclair 8f3c6356d4 Remove KillStatement
This CL removes the KillStatement from the AST and replaces all test
usage with DiscardStatement.

Bug: tint:169
Change-Id: Ie68dd3cdd54056f144d10506f05cc1f6903d1cda
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25605
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:33:50 +00:00
dan sinclair b4374c271e [ast] Add DiscardStatement AST node.
This CL adds DiscardStatement to the AST.

Bug: tint:162
Change-Id: I1905023eb8297d9a983884e77c6a2267fd43a076
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25601
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 03:34:33 +00:00
dan sinclair 2e40491467 Add a call ast statement.
This CL adds CallStatement to the AST to allow wrapping a CallExpression
into a statement.

Bug: tint:45
Change-Id: I5a9525514344fcc2cf9900eb2cd78c1fb94ca2ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25320
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 13:42:05 +00:00
dan sinclair 2b23e4bd70 Remove unless_stmt
The `unless` statement was removed from the WGSL grammar so remove it
from Tint.

Change-Id: I31a185f5c5e3e88b667caea1c9a88aee80c0b810
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22581
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-06-03 16:11:37 +00:00
dan sinclair 5370390096 Remove NOP.
The NOP command was added for complete SPIR-V bijectivity which is no
longer a goal of WGSL. The NOP command has been removed from the spec,
so remove from Tint.

Change-Id: Ic640d9d3b987a19668dc169ff549444921c5bbb8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22160
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-05-26 15:05:54 +00:00
Sarah Mashayekhi 194b6a2fce Adding const As.* functions to statement class
Change-Id: Ie9c0cecfce1ebb7decf377cee7053fb7ae0dee9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20260
Reviewed-by: David Neto <dneto@google.com>
2020-04-23 13:52:10 +00:00
dan sinclair efb5d4e10f Remove regardless.
This CL removes the regardless statement and turns `regardless` into a
reserved word.

Change-Id: I50c521111b90dbadddaeb36674e8c40205186076
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19361
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 14:46:51 +00:00
Ryan Harrison 4d32be4f1b Remove suppressing [chromium-style] errors
Lots of little style nits needed to be fixed for this work.

BUG=tint:44

Change-Id: Ibb45d9e3f6795ee0c09f5eca994bb28e20979d97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19221
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-09 18:52:06 +00:00
dan sinclair e49bd5eeb4 Rename VariableStatement to VariableDeclStatement.
This CL renames VariableStatement to VariableDeclStatement to make it
clearer what it was modeling.

Bug: tint:25
Change-Id: Idd0d27fad7cc402f286e1abad74092c9d1961d91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18341
Reviewed-by: David Neto <dneto@google.com>
2020-03-30 22:46:48 +00:00
Dan Sinclair 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00