Ownership Representation - #1099
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1099 +/- ##
==========================================
+ Coverage 87.74% 87.85% +0.11%
==========================================
Files 23 23
Lines 6429 6489 +60
==========================================
+ Hits 5641 5701 +60
Misses 788 788
🚀 New features to boost your workflow:
|
|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '3' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1814: Calling 'GetOwnershipBitmask'
INTEROP_TRACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1773: Taking false branch
ef Fn) {
^lib/CppInterOp/CppInterOp.cpp:1775: Assuming 'D' is a 'CastReturnType'
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: 'FD' is non-null
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: Taking true branch
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Returns:' at line 1781
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1783: Execution continues on line 1778
rns;
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Holds:' at line 1787
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1787: Calling 'operator|'
nershipAttr::Holds:
^include/CppInterOp/CppInterOpTypes.h:444: The value '3' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1814: Calling 'GetOwnershipBitmask'
INTEROP_TRACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1773: Taking false branch
ef Fn) {
^lib/CppInterOp/CppInterOp.cpp:1775: Assuming 'D' is a 'CastReturnType'
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: 'FD' is non-null
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: Taking true branch
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Returns:' at line 1781
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1783: Execution continues on line 1778
rns;
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Takes:' at line 1784
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1784: Calling 'operator|'
nershipAttr::Takes:
^include/CppInterOp/CppInterOpTypes.h:444: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '6' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1814: Calling 'GetOwnershipBitmask'
INTEROP_TRACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1773: Taking false branch
ef Fn) {
^lib/CppInterOp/CppInterOp.cpp:1775: Assuming 'D' is a 'CastReturnType'
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: 'FD' is non-null
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: Taking true branch
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Takes:' at line 1784
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1786: Execution continues on line 1778
kes;
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Holds:' at line 1787
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1787: Calling 'operator|'
nershipAttr::Holds:
^include/CppInterOp/CppInterOpTypes.h:444: The value '6' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '7' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1814: Calling 'GetOwnershipBitmask'
INTEROP_TRACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1773: Taking false branch
ef Fn) {
^lib/CppInterOp/CppInterOp.cpp:1775: Assuming 'D' is a 'CastReturnType'
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: 'FD' is non-null
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1775: Taking true branch
p<clang::Decl>(Fn);
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Returns:' at line 1781
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1783: Execution continues on line 1778
rns;
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Takes:' at line 1784
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1786: Execution continues on line 1778
kes;
^lib/CppInterOp/CppInterOp.cpp:1780: Control jumps to 'case Holds:' at line 1787
switch (kind) {
^lib/CppInterOp/CppInterOp.cpp:1787: Calling 'operator|'
nershipAttr::Holds:
^include/CppInterOp/CppInterOpTypes.h:444: The value '7' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^| return INTEROP_RETURN(llvm::isa_and_nonnull<clang::FunctionProtoType>(T)); | ||
| } | ||
|
|
||
| static OwnershipBehaviour GetOwnershipBitmask(ConstFuncRef Fn) { |
There was a problem hiding this comment.
warning: no header providing "Cpp::OwnershipBehaviour" is directly included [misc-include-cleaner]
nProtoType>(T));
^| def GetDeallocationIndexes : CppInterOpAPI { | ||
| let Doc = [{Returns the 0-based indices of the parameters whose ownership the | ||
| function takes or holds, as annotated by ownership_takes/ownership_holds.}]; | ||
|
|
||
| let ReturnType = "std::vector<unsigned>"; | ||
| let Args = [ | ||
| Arg<"ConstFuncRef", "func"> | ||
| ]; | ||
| } |
There was a problem hiding this comment.
We should return an int here.
If we still want to represent multiple arguments, we can represent them as a bit mask, where the nth LSB is 1 if the function takes ownership of the nth argument.
| def IsOwnershipReturns : CppInterOpAPI { | ||
| let Doc = "Checks whether the function is annotated with ownership_returns."; | ||
|
|
||
| let ReturnType = "bool"; | ||
| let Args = [ | ||
| Arg<"ConstFuncRef", "func"> | ||
| ]; | ||
| } | ||
|
|
||
| def IsOwnershipTakes : CppInterOpAPI { | ||
| let Doc = "Checks whether the function is annotated with ownership_takes."; | ||
|
|
||
| let ReturnType = "bool"; | ||
| let Args = [ | ||
| Arg<"ConstFuncRef", "func"> | ||
| ]; | ||
| } | ||
|
|
||
| def IsOwnershipHolds : CppInterOpAPI { | ||
| let Doc = "Checks whether the function is annotated with ownership_holds."; | ||
|
|
||
| let ReturnType = "bool"; | ||
| let Args = [ | ||
| Arg<"ConstFuncRef", "func"> | ||
| ]; | ||
| } |
There was a problem hiding this comment.
Combine into one function:
OwnershipBehaviour GetOwnershipBehaviour(ConstFuncRef);There was a problem hiding this comment.
That was how i started to implement, but that does not work. A function can both return ownership, take ownership of one argument and holds another one, so one attribute does not disable others. If I had implement something like GetOwnershipBehaviour I had to choose either first or last attribute in AST which makes no sense
There was a problem hiding this comment.
But if you meant returning a bitmask that will probably work
| return OwnershipBehaviour::Unknown; | ||
| const auto* D = unwrap<clang::Decl>(Fn); | ||
| if (const auto* FD = dyn_cast<FunctionDecl>(D)) { | ||
| OwnershipBehaviour result = OwnershipBehaviour::Unknown; // 0b000 |
There was a problem hiding this comment.
| OwnershipBehaviour result = OwnershipBehaviour::Unknown; // 0b000 | |
| OwnershipBehaviour result = OwnershipBehaviour::Unknown; |
?
There was a problem hiding this comment.
Just wanted to show it is 0 integral, acts as start point
| bool IsFunctionProtoType(ConstTypeRef TyRef) { | ||
| INTEROP_TRACE(TyRef); | ||
| QualType QT = QualType::getFromOpaquePtr(TyRef.data); | ||
| const auto* T = QT.getTypePtr(); | ||
| return INTEROP_RETURN(llvm::isa_and_nonnull<clang::FunctionProtoType>(T)); | ||
| } |
There was a problem hiding this comment.
Why do we move this function?
There was a problem hiding this comment.
Just to be consistent, I implemented Isallocator in the wrong place at first, they should be adjacent with analyzers.
| inline QualKind operator|(QualKind a, QualKind b) { | ||
| return static_cast<QualKind>(static_cast<unsigned char>(a) | | ||
| static_cast<unsigned char>(b)); | ||
| } | ||
|
|
There was a problem hiding this comment.
Why is this required? Not used anywhere.
There was a problem hiding this comment.
It is used
switch (kind) {
case OwnershipAttr::Returns:
result = result | OwnershipBehaviour::OwnershipReturns;
break;
case OwnershipAttr::Takes:
result = result | OwnershipBehaviour::OwnershipTakes;
break;616b586 to
28cee59
Compare
…ership returns-takes behaviour based on ownership_... attributes, also added API for getting index of deallocated parameters for functions take ownership, and if it is specified another API is available to get which parameter decides the size of allocation for functions return ownership. Also some replacements that are not important.
28cee59 to
e5c9722
Compare
|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '3' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1779: Taking false branch
ACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1781: Assuming 'D' is not a 'CastReturnType'
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: 'FTD' is null
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: Taking false branch
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1783: Assuming 'D' is a 'CastReturnType'
getTemplatedDecl();
^lib/CppInterOp/CppInterOp.cpp:1785: 'FD' is non-null
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1785: Taking false branch
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Holds:' at line 1797
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1801: Execution continues on line 1789
break;
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Returns:' at line 1791
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1791: Calling 'operator|'
rshipAttr::Returns:
^include/CppInterOp/CppInterOpTypes.h:444: The value '3' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1779: Taking false branch
ACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1781: Assuming 'D' is not a 'CastReturnType'
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: 'FTD' is null
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: Taking false branch
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1783: Assuming 'D' is a 'CastReturnType'
getTemplatedDecl();
^lib/CppInterOp/CppInterOp.cpp:1785: 'FD' is non-null
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1785: Taking false branch
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Returns:' at line 1791
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1793: Execution continues on line 1789
turns;
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Takes:' at line 1794
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1794: Calling 'operator|'
nershipAttr::Takes:
^include/CppInterOp/CppInterOpTypes.h:444: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^unittests/CppInterOp/FunctionReflectionTest.cpp:1141: Control jumps to 'case 0:' at line 1142
ur;
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:77: expanded from macro 'GTEST_ASSERT_'
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/internal/gtest-port.h:732: expanded from macro 'GTEST_AMBIGUOUS_ELSE_BLOCKER_'
switch (0) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1141: Assuming the condition is true
ur;
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1141: Taking true branch
ur;
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1142: Control jumps to 'case 0:' at line 1143
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:77: expanded from macro 'GTEST_ASSERT_'
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/internal/gtest-port.h:732: expanded from macro 'GTEST_AMBIGUOUS_ELSE_BLOCKER_'
switch (0) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1142: Assuming the condition is true
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1142: Taking true branch
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1143: Control jumps to 'case 0:' at line 1144
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:77: expanded from macro 'GTEST_ASSERT_'
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/internal/gtest-port.h:732: expanded from macro 'GTEST_AMBIGUOUS_ELSE_BLOCKER_'
switch (0) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1143: Assuming the condition is true
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1143: Taking true branch
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1144: Control jumps to 'case 0:' at line 1145
s);
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:77: expanded from macro 'GTEST_ASSERT_'
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/internal/gtest-port.h:732: expanded from macro 'GTEST_AMBIGUOUS_ELSE_BLOCKER_'
switch (0) \
^unittests/CppInterOp/FunctionReflectionTest.cpp:1145: Calling 'operator|'
e),
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest.h:1894: expanded from macro 'EXPECT_EQ'
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:143: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:133: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
^build/unittests/googletest-prefix/src/googletest/googletest/include/gtest/gtest_pred_impl.h:78: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^include/CppInterOp/CppInterOpTypes.h:444: The value '5' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '6' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1779: Taking false branch
ACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1781: Assuming 'D' is not a 'CastReturnType'
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: 'FTD' is null
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: Taking false branch
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1783: Assuming 'D' is a 'CastReturnType'
getTemplatedDecl();
^lib/CppInterOp/CppInterOp.cpp:1785: 'FD' is non-null
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1785: Taking false branch
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Holds:' at line 1797
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1801: Execution continues on line 1789
break;
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Takes:' at line 1794
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1794: Calling 'operator|'
nershipAttr::Takes:
^include/CppInterOp/CppInterOpTypes.h:444: The value '6' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^|
|
||
| inline OwnershipBehaviour operator|(OwnershipBehaviour A, | ||
| OwnershipBehaviour B) { | ||
| return static_cast<OwnershipBehaviour>(static_cast<unsigned char>(A) | |
There was a problem hiding this comment.
warning: The value '7' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour' [clang-analyzer-optin.core.EnumCastOutOfRange]
iour B) {
^Additional context
include/CppInterOp/CppInterOpTypes.h:434: enum declared here
alyze
^lib/CppInterOp/CppInterOp.cpp:1779: Taking false branch
ACE(Fn);
^lib/CppInterOp/CppInterOp.cpp:1781: Assuming 'D' is not a 'CastReturnType'
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: 'FTD' is null
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1781: Taking false branch
<clang::Decl>(Fn));
^lib/CppInterOp/CppInterOp.cpp:1783: Assuming 'D' is a 'CastReturnType'
getTemplatedDecl();
^lib/CppInterOp/CppInterOp.cpp:1785: 'FD' is non-null
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1785: Taking false branch
ecl>(D);
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Holds:' at line 1797
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1801: Execution continues on line 1789
break;
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Returns:' at line 1791
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1793: Execution continues on line 1789
turns;
^lib/CppInterOp/CppInterOp.cpp:1789: Control jumps to 'case Takes:' at line 1794
OwnershipAttr>()) {
^lib/CppInterOp/CppInterOp.cpp:1794: Calling 'operator|'
nershipAttr::Takes:
^include/CppInterOp/CppInterOpTypes.h:444: The value '7' provided to the cast expression is not in the valid range of values for 'OwnershipBehaviour'
iour B) {
^| return INTEROP_RETURN(llvm::isa_and_nonnull<clang::FunctionProtoType>(T)); | ||
| } | ||
|
|
||
| OwnershipBehaviour GetOwnershipBehaviour(ConstFuncRef Fn) { |
There was a problem hiding this comment.
warning: no header providing "Cpp::OwnershipBehaviour" is directly included [misc-include-cleaner]
nProtoType>(T));
^
Besides Alloc-DeallocType, a new added for representing functions ownership returns-takes behaviour based on ownership_... attributes, also added API for getting index of deallocated parameters for functions take ownership, and if it is specified another API is available to get which parameter decides the size of allocation for functions return ownership. Also some replacements that are not important.
@Vipul-Cariappa