[HLSL][RootSignature] Implement diagnostic for missed comma (#147350) This pr fixes a bug that allows parameters to be specified without an intermediate comma. After this pr, we will correctly produce a diagnostic for (eg): ``` RootFlags(0) CBV(b0) ``` This pr updates the problematic code pattern containing a chain of 'if' statements to a chain of 'else if' statements, to prevent parsing of an element before checking for a comma. This pr also does 2 small updates, while in the region: 1. Simplify the `do` loop that these `if` statements are contained in. This helps code readability and makes it easier to improve the diagnostics further 2. Moves the `consumeExpectedToken` function calls to be right after the `parse.*Params` invocation. This will ensure that the comma or invalid token error is presented before a "missed mandatory param" diagnostic. - Updates all occurrences of the if chains with an else-if chain - Simplifies the surrounding `do` loop to be an easier to understand `while` loop - Moves the `consumeExpectedToken` diagnostic right after the loop so that the missing comma diagnostic is produce before checking for any missed mandatory arguments - Adds unit tests for this scenario - Small fix to the diagnostic of `RootDescriptors` to use their respective `Token` instead of `RootConstants` Resolves: https://github.com/llvm/llvm-project/issues/147337
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.