Complete VTable class name for types
Currently, in the RTTI Builder vTableClassNameForType, we return the VTable Class name for each type. This task's scope is to complete the support for the NYI types and add a test for that.
- In the VTableClassNameForType function, check branches with NYI error and choose one type.
- Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
- Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Notes:
- Please mention what type you will work on in this issue.
- Please keep it one PR per type.
- Check
Throws.cppandCIRGenItaniumCXXAPI.cppchanges for reference in #163078. - If the type is handled by you, see no test for it, feel free to add one.
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Amr Hesham (AmrDeveloper)
- In the VTableClassNameForType function, check branches with NYI error and choose one type.
- Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
- Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Notes:
- Please mention what type you will work on in this issue.
- Please keep it one PR per type.
- Check
Throws.cppandCIRGenItaniumCXXAPI.cppchanges for reference in #163078. - If the type is handled by you, see no test for it, feel free to add one.
Hello, I would like to work on the enum type :)
I would like to work on the array types (Type::ConstantArray, Type::IncompleteArray and Type::VariableArray).
Hello, I would like to work on the FunctionNoProto and FunctionProto type.
Hello, I would like to work on the:
Type::ObjCObjectPointerType::PointerType::MemberPointer
please 😇
I can also take Auto and DeducedTemplateSpecialization.
I think I have found the correct string to return for Type::ConstantArray, Type::IncompleteArray and Type::VariableArray, _ZTVN10__cxxabiv117__array_type_infoE, but I'm not sure how I could test it.
throw expression applies the array-to-pointer conversion on expression and the other thing I wanted to try is a catch trying to catch an array type, but try doesn't seem to be implemented yet, so I couldn't actually try that. Is there some other possibility that I'm missing here?
Type::ObjCObjectPointerType::PointerType::MemberPointer
So I did some debugging, and looks like we can do this part for now:
Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
But not this one:
Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Because later in the code during call to CIRGenItaniumRTTIBuilder::buildTypeInfo f.e. line 1405 there is
cgm.errorNYI("buildTypeInfo: Pointer"); and hence it will stop execution and not emit RTTI.
Should we for now skip updating this three types in VTableClassNameForType function until they will be implemented in buildTypeInfo ?
@AmrDeveloper
Type::ObjCObjectPointerType::PointerType::MemberPointerSo I did some debugging, and looks like we can do this part for now:
Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
But not this one:
Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Because later in the code during call to CIRGenItaniumRTTIBuilder::buildTypeInfo f.e. line 1405 there is
cgm.errorNYI("buildTypeInfo: Pointer");and hence it will stop execution and not emit RTTI.Should we for now skip updating this three types in
VTableClassNameForType functionuntil they will be implemented in buildTypeInfo ?
Yes, If something is not yet implemented, we should skip it for now
Yes, If something is not yet implemented, we should skip it for now
I opened #164155 for the array types, but ran into a similar issue there. There are 3 array types, one of which could be tested once try/catch is upstreamed, but the other 2, unless I'm missing something, can only be tested with typeid, which isn't even implemented in the incubator, so I should close that PR?
Yes, If something is not yet implemented, we should skip it for now
I opened #164155 for the array types, but ran into a similar issue there. There are 3 array types, one of which could be tested once try/catch is upstreamed, but the other 2, unless I'm missing something, can only be tested with
typeid, which isn't even implemented in the incubator, so I should close that PR?
I think you can keep it as a draft for now, and I will ping you once try/catch is upstreamed (I have already opened a PR for it). I will check typeid too
I have wrote two test cases for my task, but I just don't know how to build and run them on my Mac, I need some help.
Hello, I would like to work on the
FunctionNoProtoandFunctionPrototype.
I have wrote two test cases for my task, but I just don't know how to build and run them on my Mac, I need some help.
Hello, I would like to work on the
FunctionNoProtoandFunctionPrototype.
Build clang
ninja clang
Run ClangIR codegen tests
ninja check-clang-cir-codegen
Run a single lit test file (make sure to build clang before)
bin/llvm-lit -sv <path>
@AmrDeveloper Where should I run ninja check-clang-cir-codegen after I build Clang by ninja clang? I don't know run it in which directory. Here is what I got:
ninja: error: unknown target 'check-clang-cir-codegen'
@AmrDeveloper Where should I run
ninja check-clang-cir-codegenafter I build Clang byninja clang? I don't know run it in which directory. Here is what I got:ninja: error: unknown target 'check-clang-cir-codegen'
let me link your thread on discourse so if anyone else face the same issue
https://discourse.llvm.org/t/how-to-build-test-on-a-mac/88727/6
Hello. I would like to work on Type::ObjCInterface.
Writing down here the types that are already picked up by people so it is easier for new contributors to see which types are already picked.
| Type | Assignee |
|---|---|
| Type::ObjCInterface | @ARandomDev99 |
| Type::ObjCObjectPointer | @n2h9 |
| Type::Pointer | @n2h9 |
| Type::MemberPointer | @n2h9 |
| Type::FunctionNoProto | @y-Adrian |
| Type::FunctionProto | @y-Adrian |
| Type::ConstantArray | @MihailMihov |
| Type::IncompleteArray | @MihailMihov |
| Type::VariableArray | @MihailMihov |
| Type::Enum | @moar55 |
| Type::DeducedTemplateSpecialization | @moar55 |
| Type::Auto | @moar55 |
Type::ObjCObjectPointerType::PointerType::MemberPointerSo I did some debugging, and looks like we can do this part for now:
Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
But not this one:
Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Because later in the code during call to CIRGenItaniumRTTIBuilder::buildTypeInfo f.e. line 1405 there is
cgm.errorNYI("buildTypeInfo: Pointer");and hence it will stop execution and not emit RTTI. Should we for now skip updating this three types inVTableClassNameForType functionuntil they will be implemented in buildTypeInfo ? @AmrDeveloperYes, If something is not yet implemented, we should skip it for now
I've looked into the implementation and noticed that buildTypeInfo depends on vTableClassNameForType. Can I try to complete the full implementation for both at the same time?
Type::ObjCObjectPointerType::PointerType::MemberPointerSo I did some debugging, and looks like we can do this part for now:
Find and return the correct VTableClass name, either from the ClangIR repository or the classical codegen.
But not this one:
Write a test that emits RTTI for that type (Hint: One way is to throw expr with that type).
Because later in the code during call to CIRGenItaniumRTTIBuilder::buildTypeInfo f.e. line 1405 there is
cgm.errorNYI("buildTypeInfo: Pointer");and hence it will stop execution and not emit RTTI. Should we for now skip updating this three types inVTableClassNameForType functionuntil they will be implemented in buildTypeInfo ? @AmrDeveloperYes, If something is not yet implemented, we should skip it for now
I've looked into the implementation and noticed that
buildTypeInfodepends onvTableClassNameForType. Can I try to complete the full implementation for both at the same time?
no objections from my side 👍