Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
baf2ffaf
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
baf2ffaf
编写于
8月 15, 2023
作者:
C
cyberslack_lee
提交者:
GitHub
8月 15, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[clang-tidy] No.37 enable performance-faster-string-find (#56255)
上级
4526f61e
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
15 addition
and
15 deletion
+15
-15
.clang-tidy
.clang-tidy
+1
-1
paddle/fluid/framework/details/nan_inf_utils_detail.cc
paddle/fluid/framework/details/nan_inf_utils_detail.cc
+1
-1
paddle/fluid/framework/ir/fusion_group/code_generator_helper.cc
.../fluid/framework/ir/fusion_group/code_generator_helper.cc
+6
-6
paddle/fluid/framework/op_call_stack.cc
paddle/fluid/framework/op_call_stack.cc
+1
-1
paddle/fluid/jit/property.cc
paddle/fluid/jit/property.cc
+1
-1
paddle/fluid/jit/serializer_utils.cc
paddle/fluid/jit/serializer_utils.cc
+2
-2
paddle/phi/api/lib/op_meta_info.cc
paddle/phi/api/lib/op_meta_info.cc
+1
-1
paddle/phi/core/enforce.cc
paddle/phi/core/enforce.cc
+2
-2
未找到文件。
.clang-tidy
浏览文件 @
baf2ffaf
...
@@ -188,7 +188,7 @@ modernize-use-nullptr,
...
@@ -188,7 +188,7 @@ modernize-use-nullptr,
modernize-use-override,
modernize-use-override,
-modernize-use-transparent-functors,
-modernize-use-transparent-functors,
-modernize-use-uncaught-exceptions,
-modernize-use-uncaught-exceptions,
-
performance-faster-string-find,
performance-faster-string-find,
-performance-for-range-copy,
-performance-for-range-copy,
-performance-implicit-conversion-in-loop,
-performance-implicit-conversion-in-loop,
-performance-inefficient-algorithm,
-performance-inefficient-algorithm,
...
...
paddle/fluid/framework/details/nan_inf_utils_detail.cc
浏览文件 @
baf2ffaf
...
@@ -141,7 +141,7 @@ static void InitWhiteListFormEnv() {
...
@@ -141,7 +141,7 @@ static void InitWhiteListFormEnv() {
std
::
stringstream
ss
(
op_var_skip
);
std
::
stringstream
ss
(
op_var_skip
);
std
::
string
op_var
;
std
::
string
op_var
;
while
(
std
::
getline
(
ss
,
op_var
,
','
))
{
while
(
std
::
getline
(
ss
,
op_var
,
','
))
{
auto
pos
=
op_var
.
find
(
":"
);
auto
pos
=
op_var
.
find
(
':'
);
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
pos
!=
std
::
string
::
npos
,
pos
!=
std
::
string
::
npos
,
true
,
true
,
...
...
paddle/fluid/framework/ir/fusion_group/code_generator_helper.cc
浏览文件 @
baf2ffaf
...
@@ -34,12 +34,12 @@ static T StringTo(const std::string& str) {
...
@@ -34,12 +34,12 @@ static T StringTo(const std::string& str) {
static
std
::
string
ExpandMultivariateTemplate
(
const
std
::
string
&
rhs
,
static
std
::
string
ExpandMultivariateTemplate
(
const
std
::
string
&
rhs
,
const
size_t
input_size
)
{
const
size_t
input_size
)
{
int
start_pos
=
rhs
.
find
(
"["
,
0
);
int
start_pos
=
rhs
.
find
(
'['
,
0
);
int
end_pos
=
rhs
.
find
(
"]"
,
0
);
int
end_pos
=
rhs
.
find
(
']'
,
0
);
std
::
string
sum_rhs
=
rhs
.
substr
(
0
,
start_pos
);
std
::
string
sum_rhs
=
rhs
.
substr
(
0
,
start_pos
);
std
::
string
repeated_component
=
std
::
string
repeated_component
=
rhs
.
substr
(
start_pos
+
1
,
(
end_pos
-
start_pos
-
1
));
rhs
.
substr
(
start_pos
+
1
,
(
end_pos
-
start_pos
-
1
));
int
replace_pos
=
repeated_component
.
find
(
"?"
,
0
);
int
replace_pos
=
repeated_component
.
find
(
'?'
,
0
);
for
(
size_t
i
=
1
;
i
<
input_size
;
i
++
)
{
for
(
size_t
i
=
1
;
i
<
input_size
;
i
++
)
{
std
::
string
append_str
=
repeated_component
;
std
::
string
append_str
=
repeated_component
;
...
@@ -64,9 +64,9 @@ static std::string RefineTemplateWithAttr(const std::string& op_type,
...
@@ -64,9 +64,9 @@ static std::string RefineTemplateWithAttr(const std::string& op_type,
// Get attr with different type, Now we only support the simple attr
// Get attr with different type, Now we only support the simple attr
// condition
// condition
std
::
string
attr_name
,
default_value
;
std
::
string
attr_name
,
default_value
;
if
(
exp_definition
.
find
(
"="
)
!=
std
::
string
::
npos
)
{
if
(
exp_definition
.
find
(
'='
)
!=
std
::
string
::
npos
)
{
attr_name
=
exp_definition
.
substr
(
0
,
exp_definition
.
find
(
"="
));
attr_name
=
exp_definition
.
substr
(
0
,
exp_definition
.
find
(
'='
));
default_value
=
exp_definition
.
substr
(
exp_definition
.
rfind
(
"="
)
+
1
,
default_value
=
exp_definition
.
substr
(
exp_definition
.
rfind
(
'='
)
+
1
,
exp_definition
.
length
()
-
1
);
exp_definition
.
length
()
-
1
);
ret
=
default_value
;
ret
=
default_value
;
}
else
{
}
else
{
...
...
paddle/fluid/framework/op_call_stack.cc
浏览文件 @
baf2ffaf
...
@@ -25,7 +25,7 @@ std::string InsertIndentationIntoEachLine(const std::string &str) {
...
@@ -25,7 +25,7 @@ std::string InsertIndentationIntoEachLine(const std::string &str) {
std
::
ostringstream
sout
;
std
::
ostringstream
sout
;
size_t
start_pos
=
0
;
size_t
start_pos
=
0
;
size_t
end_pos
=
0
;
size_t
end_pos
=
0
;
while
((
end_pos
=
str
.
find_first_of
(
"
\n
"
,
start_pos
))
!=
std
::
string
::
npos
)
{
while
((
end_pos
=
str
.
find_first_of
(
'\n'
,
start_pos
))
!=
std
::
string
::
npos
)
{
sout
<<
" "
<<
str
.
substr
(
start_pos
,
end_pos
-
start_pos
+
1
);
sout
<<
" "
<<
str
.
substr
(
start_pos
,
end_pos
-
start_pos
+
1
);
start_pos
=
end_pos
+
1
;
start_pos
=
end_pos
+
1
;
}
}
...
...
paddle/fluid/jit/property.cc
浏览文件 @
baf2ffaf
...
@@ -86,7 +86,7 @@ std::unordered_map<std::string, std::shared_ptr<Variable>> Property::Values() {
...
@@ -86,7 +86,7 @@ std::unordered_map<std::string, std::shared_ptr<Variable>> Property::Values() {
if
(
entry
.
has_name
())
{
if
(
entry
.
has_name
())
{
auto
&
n
=
entry
.
name
();
auto
&
n
=
entry
.
name
();
// remove Class Name suffix
// remove Class Name suffix
auto
key
=
n
.
substr
(
n
.
find_first_of
(
"."
)
+
1
);
auto
key
=
n
.
substr
(
n
.
find_first_of
(
'.'
)
+
1
);
std
::
shared_ptr
<
Variable
>
var
(
new
Variable
());
std
::
shared_ptr
<
Variable
>
var
(
new
Variable
());
auto
type
=
entry
.
type
();
auto
type
=
entry
.
type
();
switch
(
type
)
{
switch
(
type
)
{
...
...
paddle/fluid/jit/serializer_utils.cc
浏览文件 @
baf2ffaf
...
@@ -70,12 +70,12 @@ const std::vector<std::pair<std::string, std::string>> PdmodelFilePaths(
...
@@ -70,12 +70,12 @@ const std::vector<std::pair<std::string, std::string>> PdmodelFilePaths(
std
::
string
format_path
=
path
;
std
::
string
format_path
=
path
;
ReplaceAll
(
&
format_path
,
R"(\\)"
,
"/"
);
ReplaceAll
(
&
format_path
,
R"(\\)"
,
"/"
);
ReplaceAll
(
&
format_path
,
R"(\)"
,
"/"
);
ReplaceAll
(
&
format_path
,
R"(\)"
,
"/"
);
if
(
format_path
.
find
(
"/"
)
==
std
::
string
::
npos
)
{
if
(
format_path
.
find
(
'/'
)
==
std
::
string
::
npos
)
{
format_path
=
"./"
+
format_path
;
format_path
=
"./"
+
format_path
;
}
}
std
::
string
layer_name
=
std
::
string
layer_name
=
format_path
.
substr
(
format_path
.
find_last_of
(
"/"
)
+
1
);
format_path
.
substr
(
format_path
.
find_last_of
(
'/'
)
+
1
);
std
::
string
dir_path
=
std
::
string
dir_path
=
format_path
.
substr
(
0
,
format_path
.
length
()
-
layer_name
.
length
());
format_path
.
substr
(
0
,
format_path
.
length
()
-
layer_name
.
length
());
DIR
*
dir
=
opendir
(
dir_path
.
c_str
());
DIR
*
dir
=
opendir
(
dir_path
.
c_str
());
...
...
paddle/phi/api/lib/op_meta_info.cc
浏览文件 @
baf2ffaf
...
@@ -39,7 +39,7 @@ std::string trim_spaces(const std::string& str) {
...
@@ -39,7 +39,7 @@ std::string trim_spaces(const std::string& str) {
}
}
std
::
vector
<
std
::
string
>
ParseAttrStr
(
const
std
::
string
&
attr
)
{
std
::
vector
<
std
::
string
>
ParseAttrStr
(
const
std
::
string
&
attr
)
{
auto
split_pos
=
attr
.
find_first_of
(
":"
);
auto
split_pos
=
attr
.
find_first_of
(
':'
);
PADDLE_ENFORCE_NE
(
split_pos
,
PADDLE_ENFORCE_NE
(
split_pos
,
std
::
string
::
npos
,
std
::
string
::
npos
,
phi
::
errors
::
InvalidArgument
(
phi
::
errors
::
InvalidArgument
(
...
...
paddle/phi/core/enforce.cc
浏览文件 @
baf2ffaf
...
@@ -176,7 +176,7 @@ void ThrowWarnInternal(const std::string& msg) {
...
@@ -176,7 +176,7 @@ void ThrowWarnInternal(const std::string& msg) {
std
::
string
SimplifyErrorTypeFormat
(
const
std
::
string
&
str
)
{
std
::
string
SimplifyErrorTypeFormat
(
const
std
::
string
&
str
)
{
std
::
ostringstream
sout
;
std
::
ostringstream
sout
;
size_t
type_end_pos
=
str
.
find
(
":"
,
0
);
size_t
type_end_pos
=
str
.
find
(
':'
,
0
);
if
(
type_end_pos
==
std
::
string
::
npos
)
{
if
(
type_end_pos
==
std
::
string
::
npos
)
{
sout
<<
str
;
sout
<<
str
;
}
else
{
}
else
{
...
@@ -278,7 +278,7 @@ std::string GetExternalErrorMsg(T status) {
...
@@ -278,7 +278,7 @@ std::string GetExternalErrorMsg(T status) {
Dl_info
info
;
Dl_info
info
;
if
(
dladdr
(
reinterpret_cast
<
void
*>
(
GetCurrentTraceBackString
),
&
info
))
{
if
(
dladdr
(
reinterpret_cast
<
void
*>
(
GetCurrentTraceBackString
),
&
info
))
{
std
::
string
phi_so_path
(
info
.
dli_fname
);
std
::
string
phi_so_path
(
info
.
dli_fname
);
const
size_t
last_slash_idx
=
phi_so_path
.
find_last_of
(
"/"
);
const
size_t
last_slash_idx
=
phi_so_path
.
find_last_of
(
'/'
);
if
(
std
::
string
::
npos
!=
last_slash_idx
)
{
if
(
std
::
string
::
npos
!=
last_slash_idx
)
{
phi_so_path
.
erase
(
last_slash_idx
,
std
::
string
::
npos
);
phi_so_path
.
erase
(
last_slash_idx
,
std
::
string
::
npos
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录