forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC] Use llvm::StringSwitch maybe? #2
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
llvm-beanz
changed the title
[NFC] Use llvm::StringSwitch
[NFC] Use llvm::StringSwitch maybe?
Sep 20, 2023
llvm-beanz
force-pushed
the
cbieneman/use-stringswitch
branch
17 times, most recently
from
September 21, 2023 01:46
5f9b327
to
72f1017
Compare
PR contains clang-format violations. First 50 lines of the diff: --- tools/clang/lib/SPIRV/SpirvEmitter.cpp (before formatting)
+++ tools/clang/lib/SPIRV/SpirvEmitter.cpp (after formatting)
@@ -12054,24 +12054,24 @@
return nullptr;
}
-hlsl::ShaderModel::Kind SpirvEmitter::getShaderModelKind(StringRef stageName)
-{
- hlsl::ShaderModel::Kind SMK = llvm::StringSwitch<hlsl::ShaderModel::Kind>(stageName)
- .Case("pixel", hlsl::ShaderModel::Kind::Pixel)
- .Case("vertex", hlsl::ShaderModel::Kind::Vertex)
- .Case("geometry", hlsl::ShaderModel::Kind::Geometry)
- .Case("hull", hlsl::ShaderModel::Kind::Hull)
- .Case("domain", hlsl::ShaderModel::Kind::Domain)
- .Case("compute", hlsl::ShaderModel::Kind::Compute)
- .Case("raygeneration", hlsl::ShaderModel::Kind::RayGeneration)
- .Case("intersection", hlsl::ShaderModel::Kind::Intersection)
- .Case("anyhit", hlsl::ShaderModel::Kind::AnyHit)
- .Case("closesthit", hlsl::ShaderModel::Kind::ClosestHit)
- .Case("miss", hlsl::ShaderModel::Kind::Miss)
- .Case("callable", hlsl::ShaderModel::Kind::Callable)
- .Case("mesh", hlsl::ShaderModel::Kind::Mesh)
- .Case("amplification", hlsl::ShaderModel::Kind::Amplification)
- .Default(hlsl::ShaderModel::Kind::Invalid);
+hlsl::ShaderModel::Kind SpirvEmitter::getShaderModelKind(StringRef stageName) {
+ hlsl::ShaderModel::Kind SMK =
+ llvm::StringSwitch<hlsl::ShaderModel::Kind>(stageName)
+ .Case("pixel", hlsl::ShaderModel::Kind::Pixel)
+ .Case("vertex", hlsl::ShaderModel::Kind::Vertex)
+ .Case("geometry", hlsl::ShaderModel::Kind::Geometry)
+ .Case("hull", hlsl::ShaderModel::Kind::Hull)
+ .Case("domain", hlsl::ShaderModel::Kind::Domain)
+ .Case("compute", hlsl::ShaderModel::Kind::Compute)
+ .Case("raygeneration", hlsl::ShaderModel::Kind::RayGeneration)
+ .Case("intersection", hlsl::ShaderModel::Kind::Intersection)
+ .Case("anyhit", hlsl::ShaderModel::Kind::AnyHit)
+ .Case("closesthit", hlsl::ShaderModel::Kind::ClosestHit)
+ .Case("miss", hlsl::ShaderModel::Kind::Miss)
+ .Case("callable", hlsl::ShaderModel::Kind::Callable)
+ .Case("mesh", hlsl::ShaderModel::Kind::Mesh)
+ .Case("amplification", hlsl::ShaderModel::Kind::Amplification)
+ .Default(hlsl::ShaderModel::Kind::Invalid);
assert(SMK != hlsl::ShaderModel::Kind::Invalid);
return SMK;
} See action log for the full diff. |
llvm-beanz
force-pushed
the
cbieneman/use-stringswitch
branch
from
September 21, 2023 01:51
72f1017
to
395ee1c
Compare
Enable exec test for hcttest -all. Fixes microsoft#5551
There were a few bugs that were difficult to reproduce. The pull request branch ref needs to be fetched and checked out manually in order to get the PR diff to construct. This change also fixes formatting to get a nice diff printed of the PR output. See an example of the error output this produces here: #2
llvm-beanz
force-pushed
the
cbieneman/use-stringswitch
branch
from
September 21, 2023 16:56
395ee1c
to
c7de16e
Compare
When building with apple-clang on MacOS, we get a linker error: ld64.lld: error: undefined symbol: llvm_assert Because the llvm_assert implementation is missing the last parameter.
For all my testing... still a bug persistes. Link to failing run: https://github.com/microsoft/DirectXShaderCompiler/actions/runs/6264722103/job/17012037925?pr=5760
This replaces a hand-rolled string parser with an llvm::StringSwitch that matches full strings. This should be more resilient and maintainable.
llvm-beanz
force-pushed
the
cbieneman/use-stringswitch
branch
from
September 21, 2023 18:02
c7de16e
to
716bfcc
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This replaces a hand-rolled string parser with an
llvm::StringSwitch that matches full strings. This should be more resilient and maintainable.