-
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
minor fix for template instantiation #1
base: inst_func
Are you sure you want to change the base?
Conversation
|
Please ignore abbe5f2 |
My bad.
If I recall correctly, I added those LOCs for instantiated classes (when working on
I used to do that too, until I started just asserting I don't know yet why template
void aFunction<bool>(bool); doesn't generate output and template
void aFunction<bool>(bool) {} does, 'cause both are valid c++ snippets. Can you try dumping the AST and see if that generates? I think it will. |
AST dump:
|
Running TranslationUnitDecl 0x55f89dff2068 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0x55f89dff2948 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128'
| `-BuiltinType 0x55f89dff2600 '__int128'
|-TypedefDecl 0x55f89dff29b8 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'
| `-BuiltinType 0x55f89dff2620 'unsigned __int128'
|-TypedefDecl 0x55f89dff2d40 <<invalid sloc>> <invalid sloc> implicit __NSConstantString '__NSConstantString_tag'
| `-RecordType 0x55f89dff2aa0 '__NSConstantString_tag'
| `-CXXRecord 0x55f89dff2a10 '__NSConstantString_tag'
|-TypedefDecl 0x55f89dff2de8 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *'
| `-PointerType 0x55f89dff2da0 'char *'
| `-BuiltinType 0x55f89dff2100 'char'
|-TypedefDecl 0x55f89e030b90 <<invalid sloc>> <invalid sloc> implicit __builtin_va_list '__va_list_tag [1]'
| `-ConstantArrayType 0x55f89e030b30 '__va_list_tag [1]' 1
| `-RecordType 0x55f89dff2ed0 '__va_list_tag'
| `-CXXRecord 0x55f89dff2e40 '__va_list_tag'
|-ClassTemplateDecl 0x55f89e030d50 <test.cpp:1:5, line:2:21> col:12 AStruct
| |-TemplateTypeParmDecl 0x55f89e030be8 <line:1:15, col:24> col:24 typename depth 0 index 0 T
| `-CXXRecordDecl 0x55f89e030cc0 <line:2:5, col:21> col:12 struct AStruct definition
| |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
| | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
| | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveConstructor exists simple trivial needs_implicit
| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveAssignment exists simple trivial needs_implicit
| | `-Destructor simple irrelevant trivial needs_implicit
| `-CXXRecordDecl 0x55f89e030fb8 <col:5, col:12> col:12 implicit struct AStruct
|-ClassTemplateDecl 0x55f89e031190 <line:4:5, line:5:19> col:11 AClass
| |-TemplateTypeParmDecl 0x55f89e031060 <line:4:15, col:24> col:24 typename depth 0 index 0 U
| `-CXXRecordDecl 0x55f89e031100 <line:5:5, col:19> col:11 class AClass definition
| |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
| | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
| | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveConstructor exists simple trivial needs_implicit
| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveAssignment exists simple trivial needs_implicit
| | `-Destructor simple irrelevant trivial needs_implicit
| `-CXXRecordDecl 0x55f89e0313f8 <col:5, col:11> col:11 implicit class AClass
`-FunctionTemplateDecl 0x55f89e031630 <line:7:5, line:8:20> col:10 aFunction
|-TemplateTypeParmDecl 0x55f89e0314a0 <line:7:15, col:24> col:24 typename depth 0 index 0 P
`-FunctionDecl 0x55f89e031590 <line:8:5, col:20> col:10 aFunction 'void ()' It did parse. `-FunctionTemplateDecl 0x55f89e031630 <line:7:5, line:8:20> col:10 aFunction
|-TemplateTypeParmDecl 0x55f89e0314a0 <line:7:15, col:24> col:24 typename depth 0 index 0 P
`-FunctionDecl 0x55f89e031590 <line:8:5, col:20> col:10 aFunction 'void ()' |
For some reason, the printAST doesn't reflect that. Any ideas why? |
I do recall that. I'm wondering how you were able to get the template parameter to append since the parsed output doesn't have that. |
That comes into the picture when we are instantiating. While defining templates, we get clang-bind/bindings/python/tests/test_parse.py Lines 341 to 371 in abbe5f2
|
Verbose output while writing files
Remove unneeded `compile_commands.json`
Add minimal files required for a nice interface and conan integration
…ilepath CMakeLists.txt.in filepath minor fix
Introduce clang_utils.py, compilation_database.py and related changes
Let's move the PR directly onto pcl/clang-bind? |
TYPE_REF
.@kunaltyagi
Linking PointCloudLibrary#7