-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[HLSL] Add implicit resource element type concepts to AST #112600
Merged
+250
−20
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
ab60544
ConceptSpecializationExpr shows up in AST!!!
bob80905 b43675f
CSE is in the right spot in the AST
bob80905 4307e45
templateArg is aligned correctly on the AST
bob80905 4beb3a3
template arguments are in the right spot!
bob80905 98200c0
template arguments are almost done
bob80905 f70fb48
IT WORKS! updated template arg name, just need to remove extraneous t…
bob80905 54917b1
break down constraint expression into simpler function
bob80905 6ebe14a
remove useless function
bob80905 1ecd544
some variable renaming, function rearranging
bob80905 19664f5
clang format
bob80905 ea0ac08
fix / add test cases
bob80905 d220a73
add default nullptr, remove comments
bob80905 8014a47
remove unused var, use vector to extend memory lifetime, may need to …
bob80905 8516483
address everything
bob80905 defc84e
remove clang::, add c++ ast generation code, fix var names
bob80905 b373f15
undo formatting problem
bob80905 4fecdc4
get rid of clang:: specifier for enum values
bob80905 80d2d25
change some function names
bob80905 d770236
clang format
bob80905 1159b02
remove referenced, update tests
bob80905 cf1a7fd
address Chris
bob80905 17696d8
fix typo
bob80905 6edf031
address Helena
bob80905 fae51c5
address damyan, clarify comments
bob80905 1722578
nfc to kick off bots again
bob80905 f50b917
clarify comment, add concept AST test
bob80905 47f106b
use namespace decl as context
bob80905 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
10 changes: 10 additions & 0 deletions
10
clang/test/AST/HLSL/is_typed_resource_element_compatible_concept.hlsl
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_typed_resource_element_compatible %s | FileCheck %s | ||
|
||
// CHECK: ConceptDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> __is_typed_resource_element_compatible | ||
// CHECK: |-TemplateTypeParmDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> referenced typename depth 0 index 0 element_type | ||
// CHECK: `-BinaryOperator 0x{{[0-9a-f]+}} <<invalid sloc>> 'bool' lvalue '<=' | ||
// CHECK: |-UnaryExprOrTypeTraitExpr 0x{{[0-9a-f]+}} <<invalid sloc>> 'unsigned long' sizeof 'element_type' | ||
// CHECK: `-IntegerLiteral 0x{{[0-9a-f]+}} <<invalid sloc>> 'unsigned long' 16 | ||
|
||
|
||
RWBuffer<float> Buffer; |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that the code in this comment really matches the AST that's being built.
RWBuffer doesn't have a member of type element_type, for example.
I think that this function is just building up the AST that corresponds to the
requires is_typed_resource_element_compatible<element_Type>
part?The AST nodes for
template<typename T> concept is_typed_resource_element_compatible =sizeof(T) <= 16;
itself is created in constructTypedBufferConceptDecl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that when parsing the C++ code in the comment, it produces more of the AST than the function is producing, but I still believe that including that extra context in the comments is helpful. The C++ code adds the structure "RWBuffer", and though it isn't being produced by
constructConceptSpecializationExpr
, it helps to know what code can be copy pasted into godbolt, for example, to see the AST that would be produced.I had originally wanted to paste the AST that would be produced, but figured getting the source code would help explain the code better and also allow those who are interested to get the AST from the code.
The first point of the comment says that
"The concept specialization expression (CSE) constructed below is constructed
so that it matches the CSE that is constructed when parsing
the below C++ code:"
Which is still accurate. The code in the function isn't claiming to be responsible for the whole AST. I will reword it slightly for more clarity.
For your last 2 questions, yes I think your statements are accurate.