Skip to content
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

Enable template features #215

Merged
merged 8 commits into from
Apr 12, 2024
Merged

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Apr 3, 2024

This PR consolidates interfaces in CppInterOp that allows:

  • Exposes information required for template function scope proxy creation - arg types, method counts, names
  • Perform template function lookups using clang::LookupResult
  • Updates existing interfaces to also handle FunctionTemplateDecl*
  • Improves the instantiation process
  • Enables auto instantiation and a basic overload selection mechanism in BestTemplateFunctionMatch

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 17. Check the log or trigger a new build to see more.

include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
std::vector<TCppFunction_t> GetTemplatedFuncs(TCppScope_t klass)
{

if (!klass)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'Cpp::TCppScope_t' (aka 'void *') -> bool [readability-implicit-bool-conversion]

Suggested change
if (!klass)
if (klass == nullptr)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you disable that clang-tidy check?

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
@aaronj0 aaronj0 marked this pull request as draft April 3, 2024 16:57
@aaronj0 aaronj0 marked this pull request as ready for review April 3, 2024 17:18
@vgvassilev
Copy link
Contributor

@maximusron, here is how we can apply git-clang-format on multiple commits: vgvassilev/clad#847

Can you update the CI action with that here too?

@aaronj0
Copy link
Collaborator Author

aaronj0 commented Apr 3, 2024

Oh yeah I will do that, was wondering why the clang-format was throwing errors

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 17. Check the log or trigger a new build to see more.

include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 21. Check the log or trigger a new build to see more.

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 11. Check the log or trigger a new build to see more.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/ScopeReflectionTest.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase this PR?

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 14. Check the log or trigger a new build to see more.

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
@aaronj0
Copy link
Collaborator Author

aaronj0 commented Apr 7, 2024

@vgvassilev the builds are failing because cppyy-backend has not been updated to the new usage of GetClassMethods where we have migrated to passing the result by reference as an out parameter.

compiler-research/cppyy-backend#93

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is another round of review.

include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good...

include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
include/clang/Interpreter/CppInterOp.h Outdated Show resolved Hide resolved
std::vector<TCppFunction_t> GetClassMethods(TCppScope_t klass)
{

template <typename DeclType>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need a template, we can take a DeclKind as a parameter.

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase?

lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
unittests/CppInterOp/FunctionReflectionTest.cpp Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@aaronj0 aaronj0 force-pushed the template-fix branch 2 times, most recently from fd89d8f to 2c0e719 Compare April 10, 2024 12:43
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vgvassilev
Copy link
Contributor

The clang-format report seems bogus. This change requires changes to cppyy and that's why the other tests failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants