-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CIR] Support more declarations without any codegen #151076
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
Merged
+39
−1
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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,32 @@ | ||
| // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir | ||
| // RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR | ||
|
|
||
| // These declarations shouldn't emit any code. Therefore the module is expected to be empty. | ||
|
|
||
| template<typename T> | ||
| concept some_concept = true; | ||
|
|
||
| template<some_concept T> | ||
| class class_template {}; | ||
|
|
||
| ; // Empty declaration | ||
|
|
||
| template<typename T> | ||
| void function_template(); | ||
|
|
||
| static_assert(true, "top level static assert"); | ||
|
|
||
| template<typename T> | ||
| using type_alias = T; | ||
|
|
||
| namespace N { | ||
| using ::class_template; // UsingShadow | ||
| } | ||
|
|
||
| template<typename T> | ||
| struct deduction_guide {}; | ||
|
|
||
| deduction_guide() -> deduction_guide<int>; | ||
|
|
||
| // CIR: module {{.*}} { | ||
| // CIR-NEXT: } |
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.
You can add
Decl::VarTemplate,Decl::VarTemplatePartialSpecialization,Decl::Block,Decl::Bindingto be complete and on par with classic codegen.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.
Variable templates are covered in #151066.
I tinkered with Blocks a little bit and it seems like it's not possible to create a
BlockDeclwithout aBlockExprwhich requires codegen that's not implemented, yet. Likewise, aBindingDeclcan only show up with aDecompositionDecland while #151073 implements them on a function scope level we don't support them on in namespace scopes, yet. So these DeclKinds would be dead code which is why I didn't add them in this PR.