Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions unittests/CppInterOp/VariableReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) {
EXPECT_EQ(datamembers.size(), 1);

intptr_t offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(3, *(int*)offset);
EXPECT_EQ(3, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(3, *(size_t*)offset);
                ^

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(3, *(size_t*)offset);
                ^


ASTContext& C = Interp->getCI()->getASTContext();
std::vector<Cpp::TemplateArgInfo> template_args = {
Expand All @@ -569,7 +569,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) {
EXPECT_EQ(datamembers.size(), 1);

offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(5, *(int*)offset);
EXPECT_EQ(5, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(5, *(size_t*)offset);
                ^

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(5, *(size_t*)offset);
                ^


std::vector<Cpp::TemplateArgInfo> ele_template_args = {
{C.IntTy.getAsOpaquePtr()}, {C.FloatTy.getAsOpaquePtr()}};
Expand All @@ -588,7 +588,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) {
EXPECT_EQ(datamembers.size(), 1);

offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(2, *(int*)offset);
EXPECT_EQ(2, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(2, *(size_t*)offset);
                ^

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(2, *(size_t*)offset);
                ^

}

TEST(VariableReflectionTest, GetEnumConstantDatamembers) {
Expand Down
Loading