-
Notifications
You must be signed in to change notification settings - Fork 30
fix JitCall codegen for function with lambda as return value #678
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
==========================================
+ Coverage 79.61% 79.71% +0.09%
==========================================
Files 9 9
Lines 3925 3944 +19
==========================================
+ Hits 3125 3144 +19
Misses 800 800
🚀 New features to boost your workflow:
|
clang-tidy review says "All clean, LGTM! 👍" |
lib/CppInterOp/CppInterOp.cpp
Outdated
DeclarationName DFunction = &getASTContext().Idents.get("function"); | ||
auto result = getSema().getStdNamespace()->lookup(DFunction); | ||
if (result.empty()) | ||
Cpp::Declare("#include <functional>"); |
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.
I feel uncomfortable including and now . I am not sure how else to solve this but is there some way to write our own minimal std::function
-like class that does what we need it to?
bool IsLambdaClass(TCppType_t type) { | ||
QualType QT = QualType::getFromOpaquePtr(type); | ||
if (auto* CXXRD = QT->getAsCXXRecordDecl()) { | ||
return CXXRD->isLambda(); |
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.
FYI isLambdaCallOperator
in clang.
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.
isLambdaCallOperator
takes a CXXMethodDecl
, but we are using QualType
to check here.
Also, we are not checking if the function is the lambda call operator; instead, we are checking if the given class is a lambda class.
3cc7e4f
to
aada7a9
Compare
clang-tidy review says "All clean, LGTM! 👍" |
lib/CppInterOp/CppInterOp.cpp
Outdated
} | ||
if (auto* CXXRD = QT->getAsCXXRecordDecl()) { | ||
if (CXXRD->isLambda()) { | ||
static bool flag = false; |
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.
No statics anymore. We have a stack of interpreters. Maybe we feed that as part of Cpp::CreateIntepreter
...
aada7a9
to
1a8c719
Compare
clang-tidy review says "All clean, LGTM! 👍" |
Description
Fixes # (issue)
Helps fix a test in cppyy
Type of change
Please tick all options which are relevant.
Testing
Checklist