Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
82fd418e
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82fd418e
编写于
5月 19, 2016
作者:
S
Shreedhar Hardikar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address a number of cpplint errors in codegen_utils_unittest.cc
上级
887aa48d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
25 deletion
+32
-25
src/backend/codegen/tests/codegen_utils_unittest.cc
src/backend/codegen/tests/codegen_utils_unittest.cc
+32
-25
未找到文件。
src/backend/codegen/tests/codegen_utils_unittest.cc
浏览文件 @
82fd418e
...
...
@@ -586,7 +586,7 @@ class CodegenUtilsTest : public ::testing::Test {
// Check the correctness of the scalar element type
ASSERT_NE
(
llvm_type
,
nullptr
);
check_functor
(
llvm_type
);
}
;
}
// Helper method for GetArrayTypeTest. Calls CodegenUtils::GetType() for
// one, two and three dimensional arrays of 'ElementType', calling
...
...
@@ -614,7 +614,8 @@ class CodegenUtilsTest : public ::testing::Test {
EXPECT_TRUE
(
llvm_type
->
isIntegerTy
(
sizeof
(
IntegerType
)
<<
3
));
};
CheckForVariousArrayDimensions
<
IntegerType
,
decltype
(
integer_check_lambda
)
>
(
integer_check_lambda
);
CheckForVariousArrayDimensions
<
IntegerType
,
decltype
(
integer_check_lambda
)
>
(
integer_check_lambda
);
}
// Helper method for GetArrayTypeTest. Tests arrays of various flavors
...
...
@@ -622,16 +623,16 @@ class CodegenUtilsTest : public ::testing::Test {
template
<
typename
PointedType
,
typename
ScalarCheckFunctor
>
void
CheckGetArrayOfPointersType
(
ScalarCheckFunctor
check_functor
)
{
// Pointer flavors
CheckForVariousArrayDimensions
<
PointedType
*
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
PointedType
*
const
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
const
PointedType
*
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
const
PointedType
*
const
,
decltype
(
check_functor
)
>
(
check_functor
);
// TODO Add checks for annotated types here
CheckForVariousArrayDimensions
<
PointedType
*
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
PointedType
*
const
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
const
PointedType
*
,
decltype
(
check_functor
)
>
(
check_functor
);
CheckForVariousArrayDimensions
<
const
PointedType
*
const
,
decltype
(
check_functor
)
>
(
check_functor
);
// TODO
(shardikar)
Add checks for annotated types here
}
// Helper method for GetArrayTypeTest. Tests various different flavors of an
...
...
@@ -648,7 +649,8 @@ class CodegenUtilsTest : public ::testing::Test {
EXPECT_EQ
(
llvm_type
,
int_llvm_type
);
};
CheckForVariousArrayDimensions
<
EnumType
,
decltype
(
enum_check_lambda
)
>
(
enum_check_lambda
);
CheckForVariousArrayDimensions
<
EnumType
,
decltype
(
enum_check_lambda
)
>
(
enum_check_lambda
);
}
// Helper method for GetScalarConstantTest. Tests
...
...
@@ -1035,7 +1037,8 @@ class CodegenUtilsTest : public ::testing::Test {
void
MakeStructArrayMemberElementAccessorFunction
(
const
std
::
string
&
function_name
,
PointerToMemberTypes
&&
...
pointers_to_members
)
{
typedef
typename
std
::
remove_extent
<
OneDimArrayMemberType
>::
type
ElementType
;
typedef
typename
std
::
remove_extent
<
OneDimArrayMemberType
>::
type
ElementType
;
typedef
ElementType
(
*
AccessorFn
)
(
const
StructType
*
,
size_t
index
);
llvm
::
Function
*
accessor_function
=
codegen_utils_
->
CreateFunction
<
AccessorFn
>
(
...
...
@@ -1051,8 +1054,9 @@ class CodegenUtilsTest : public ::testing::Test {
std
::
forward
<
PointerToMemberTypes
>
(
pointers_to_members
)...);
// Get pointer to the index in that array
llvm
::
Value
*
element_ptr
=
codegen_utils_
->
ir_builder
()
->
CreateGEP
(
array_member_ptr
,
{
codegen_utils_
->
GetConstant
(
0
),
ArgumentByPosition
(
accessor_function
,
1
)
});
array_member_ptr
,
{
codegen_utils_
->
GetConstant
(
0
),
ArgumentByPosition
(
accessor_function
,
1
)
});
// Actually load the value from the pointer.
llvm
::
Value
*
element_value
=
codegen_utils_
->
ir_builder
()
->
CreateLoad
(
element_ptr
);
...
...
@@ -1567,8 +1571,9 @@ TEST_F(CodegenUtilsTest, GetArrayTypeTest) {
};
// Unlike other types, we check only pointers, not references, because there
// is no such thing as void&.
CheckForVariousArrayDimensions
<
void
*
,
decltype
(
void_pointer_array_check_lambda
)
>
(
void_pointer_array_check_lambda
);
CheckForVariousArrayDimensions
<
void
*
,
decltype
(
void_pointer_array_check_lambda
)
>
(
void_pointer_array_check_lambda
);
// Check bool* (bool is represented as i1 in LLVM IR).
auto
bool_pointer_array_check_lambda
=
[](
const
llvm
::
Type
*
llvm_type
)
{
...
...
@@ -1653,7 +1658,8 @@ TEST_F(CodegenUtilsTest, GetArrayTypeTest) {
auto
int_pointer_check_lambda
=
[](
const
llvm
::
Type
*
llvm_type
)
{
ASSERT_NE
(
llvm_type
,
nullptr
);
EXPECT_TRUE
(
llvm_type
->
isPointerTy
());
EXPECT_TRUE
(
llvm_type
->
getPointerElementType
()
->
isIntegerTy
(
sizeof
(
int
)
<<
3
));
EXPECT_TRUE
(
llvm_type
->
getPointerElementType
()
->
isIntegerTy
(
sizeof
(
int
)
<<
3
));
};
CheckGetArrayOfPointersType
<
int
>
(
int_pointer_check_lambda
);
...
...
@@ -1678,7 +1684,8 @@ TEST_F(CodegenUtilsTest, GetArrayTypeTest) {
EXPECT_TRUE
(
llvm_type
->
getPointerElementType
()
->
getArrayElementType
()
->
isIntegerTy
(
sizeof
(
int
)
<<
3
));
};
int_pointer_to_array_of_ints_check_lambda
(
codegen_utils_
->
GetType
<
int
(
*
)
[
5
]
>
());
int_pointer_to_array_of_ints_check_lambda
(
codegen_utils_
->
GetType
<
int
(
*
)
[
5
]
>
());
}
TEST_F
(
CodegenUtilsTest
,
GetScalarConstantTest
)
{
...
...
@@ -2037,16 +2044,16 @@ TEST_F(CodegenUtilsTest, VariadicExternalFunctionTest) {
llvm
::
Function
*
llvm_printf_function
=
codegen_utils_
->
RegisterExternalFunction
(
printf
);
ASSERT_NE
(
llvm_printf_function
,
nullptr
);
ASSERT_EQ
(
(
codegen_utils_
->
GetFunctionType
<
int
,
char
*>
(
true
)
->
getPointerTo
()),
ASSERT_EQ
(
(
codegen_utils_
->
GetFunctionType
<
int
,
char
*>
(
true
)
->
getPointerTo
()),
llvm_printf_function
->
getType
());
// Register sprintf with takes variable arguments past char*, char*
llvm
::
Function
*
llvm_sprintf_function
=
codegen_utils_
->
RegisterExternalFunction
(
sprintf
);
ASSERT_NE
(
llvm_sprintf_function
,
nullptr
);
ASSERT_EQ
(
(
codegen_utils_
->
GetFunctionType
<
int
,
char
*
,
char
*>
(
true
)
->
getPointerTo
()),
ASSERT_EQ
(
(
codegen_utils_
->
GetFunctionType
<
int
,
char
*
,
char
*>
(
true
)
->
getPointerTo
()),
llvm_sprintf_function
->
getType
());
char
sprintf_with_three_args_buffer
[
16
],
sprintf_with_four_args_buffer
[
16
];
...
...
@@ -2057,7 +2064,7 @@ TEST_F(CodegenUtilsTest, VariadicExternalFunctionTest) {
llvm
::
Function
*
sprintf_test
=
codegen_utils_
->
CreateFunction
<
SprintfTestType
>
(
"sprintf_test"
);
llvm
::
BasicBlock
*
main_block
=
codegen_utils_
->
CreateBasicBlock
(
"main"
,
sprintf_test
);
codegen_utils_
->
CreateBasicBlock
(
"main"
,
sprintf_test
);
codegen_utils_
->
ir_builder
()
->
SetInsertPoint
(
main_block
);
codegen_utils_
->
ir_builder
()
->
CreateCall
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录