-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix MakeFunctionCallable
for dealing with public typedef to private type
#407
fix MakeFunctionCallable
for dealing with public typedef to private type
#407
Conversation
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.
clang-tidy made some suggestions
@@ -1652,13 +1655,13 @@ namespace Cpp { | |||
return; | |||
} else if (QT->isPointerType()) { | |||
isPointer = true; | |||
QT = cast<clang::PointerType>(QT)->getPointeeType(); | |||
QT = cast<clang::PointerType>(QT.getCanonicalType())->getPointeeType(); |
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.
warning: no header providing "clang::cast" is directly included [misc-include-cleaner]
QT = cast<clang::PointerType>(QT.getCanonicalType())->getPointeeType();
^
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.
Can we add test covering that line?
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.
Done. 👍🏽
EXPECT_TRUE(FCI_f.getKind() == Cpp::JitCall::kGenericCall); | ||
|
||
void* res = nullptr; | ||
FCI_f.Invoke(&res, {nullptr, 0}); |
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.
warning: multilevel pointer conversion from 'void **' to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
FCI_f.Invoke(&res, {nullptr, 0});
^
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
+ Coverage 70.85% 70.96% +0.10%
==========================================
Files 9 9
Lines 3538 3541 +3
==========================================
+ Hits 2507 2513 +6
+ Misses 1031 1028 -3
|
2257e1e
to
667f38e
Compare
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.
clang-tidy made some suggestions
EXPECT_EQ(set_5_f.getKind(), Cpp::JitCall::kGenericCall); | ||
|
||
int* bp = &b; | ||
void* set_5_args[1] = {(void*)&bp}; |
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.
warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
void* set_5_args[1] = {(void*)&bp};
^
EXPECT_EQ(set_5_f.getKind(), Cpp::JitCall::kGenericCall); | ||
|
||
int* bp = &b; | ||
void* set_5_args[1] = {(void*)&bp}; |
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.
warning: multilevel pointer conversion from 'int **' to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
void* set_5_args[1] = {(void*)&bp};
^
|
||
int* bp = &b; | ||
void* set_5_args[1] = {(void*)&bp}; | ||
set_5_f.Invoke(nullptr, {set_5_args, 1}); |
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.
warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
set_5_f.Invoke(nullptr, {set_5_args, 1});
^
#if CLANG_VERSION_MAJOR > 16 | ||
Policy.SuppressElaboration = true; | ||
#endif |
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.
The SuppressElaboration
Printing Policy is not part of clang <= 16
, therefor CI fails.
667f38e
to
47bfdf4
Compare
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.
clang-tidy made some suggestions
set_5_f.Invoke(nullptr, {set_5_args, 1}); | ||
EXPECT_EQ(b, 5); | ||
|
||
#if CLANG_VERSION_MAJOR > 16 |
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.
warning: no header providing "CLANG_VERSION_MAJOR" is directly included [misc-include-cleaner]
unittests/CppInterOp/FunctionReflectionTest.cpp:9:
- #include <string>
+ #include <clang/Basic/Version.h>
+ #include <string>
47bfdf4
to
d1ffcd8
Compare
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.
clang-tidy made some suggestions
#include "clang/Frontend/CompilerInstance.h" | ||
#include "clang/Interpreter/CppInterOp.h" | ||
#include "clang/Sema/Sema.h" | ||
|
||
#include "gtest/gtest.h" |
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.
warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]
#include "gtest/gtest.h"
^
@@ -4,5 +4,8 @@ Checks: > | |||
-cppcoreguidelines-macro-usage, | |||
-cppcoreguidelines-pro-type-cstyle-cast, | |||
-cppcoreguidelines-avoid-non-const-global-variables, | |||
-cppcoreguidelines-avoid-c-arrays, |
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.
Can we ignore running clang-tidy on the unittest folder instead?
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 have disabled these tests in the unittests folder.
Do you want to disable all the checks for the unittests folder?
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.
Probably start disabling one by one. Maybe some checks still make sense...
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.
LGTM!
Description
Fixes
MakeFunctionCallable
'smake_wrapper
's code generation for the situation where a public typedef is used to point to a private type.Fixes # (issue)
test24_typedef_to_private_class
at cppyy.Type of change
Please tick all options which are relevant.
Testing
Added in a test case replicating the cppyy's test.
Checklist