-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] Add BuiltinTemplates.td to generate code for builtin templates #123736
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
586dd4e
[Clang] Add BuiltinTemplates.td to generate code for builtin templates
philnik777 dc4232e
Use BTName everywhere
philnik777 8611121
Use stringstream
philnik777 417b15f
Rename protoype to temaplate_head
philnik777 c517ac9
Address comments
philnik777 9a582a1
Remove old code
philnik777 eb7a870
Address comments
philnik777 57495b6
Merge branch 'main' into builtin_templates_tablegen
philnik777 0f79dcc
Address comments
philnik777 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
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,52 @@ | ||
//===--- BuiltinTemplates.td - Clang builtin template aliases ---*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
class TemplateArg<string name> { | ||
string Name = name; | ||
} | ||
|
||
class Template<list<TemplateArg> args, string name> : TemplateArg<name> { | ||
list<TemplateArg> Args = args; | ||
} | ||
|
||
class Class<string name, bit is_variadic = 0> : TemplateArg<name> { | ||
erichkeane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bit IsVariadic = is_variadic; | ||
} | ||
|
||
class NTTP<string type_name, string name, bit is_variadic = 0> : TemplateArg<name> { | ||
string TypeName = type_name; | ||
bit IsVariadic = is_variadic; | ||
} | ||
|
||
class BuiltinNTTP<string type_name> : TemplateArg<""> { | ||
string TypeName = type_name; | ||
} | ||
|
||
def SizeT : BuiltinNTTP<"size_t"> {} | ||
|
||
class BuiltinTemplate<list<TemplateArg> template_head> { | ||
list<TemplateArg> TemplateHead = template_head; | ||
} | ||
|
||
// template <template <class T, T... Ints> IntSeq, class T, T N> | ||
def __make_integer_seq : BuiltinTemplate< | ||
[Template<[Class<"T">, NTTP<"T", "Ints", /*is_variadic=*/1>], "IntSeq">, Class<"T">, NTTP<"T", "N">]>; | ||
philnik777 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// template <size_t, class... T> | ||
def __type_pack_element : BuiltinTemplate< | ||
[SizeT, Class<"T", /*is_variadic=*/1>]>; | ||
|
||
// template <template <class... Args> BaseTemplate, | ||
// template <class TypeMember> HasTypeMember, | ||
// class HasNoTypeMember | ||
// class... Ts> | ||
def __builtin_common_type : BuiltinTemplate< | ||
[Template<[Class<"Args", /*is_variadic=*/1>], "BaseTemplate">, | ||
Template<[Class<"TypeMember">], "HasTypeMember">, | ||
Class<"HasNoTypeMember">, | ||
Class<"Ts", /*is_variadic=*/1>]>; |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.