diff options
author | Nathan James <n.james93@hotmail.co.uk> | 2020-05-08 19:30:18 +0100 |
---|---|---|
committer | Nathan James <n.james93@hotmail.co.uk> | 2020-05-09 16:21:49 +0100 |
commit | 82ddae061b4ba11895756004d559160cbd519fff (patch) | |
tree | 57c7f00f54965c3f50a3fd276f2ed7c86e494958 /llvm/lib/Analysis/CodeMetrics.cpp | |
parent | 4f4ce13944b88bcd678e615d340c21ea1cf5d3ec (diff) | |
download | llvm-82ddae061b4ba11895756004d559160cbd519fff.zip llvm-82ddae061b4ba11895756004d559160cbd519fff.tar.gz llvm-82ddae061b4ba11895756004d559160cbd519fff.tar.bz2 |
[clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved
Summary:
Sometimes in templated code Member references are reported as `DependentScopeMemberExpr` because that's what the standard dictates, however in many trivial cases it is easy to resolve the reference to its actual Member.
Take this code:
```
template<typename T>
class A{
int value;
A& operator=(const A& Other){
value = Other.value;
this->value = Other.value;
return *this;
}
};
```
When ran with `clang-tidy file.cpp -checks=readability-identifier-naming --config="{CheckOptions: [{key: readability-identifier-naming.MemberPrefix, value: m_}]}" -fix`
Current behaviour:
```
template<typename T>
class A{
int m_value;
A& operator=(const A& Other){
m_value = Other.value;
this->value = Other.value;
return *this;
}
};
```
As `this->value` and `Other.value` are Dependent they are ignored when creating the fix-its, however this can easily be resolved.
Proposed behaviour:
```
template<typename T>
class A{
int m_value;
A& operator=(const A& Other){
m_value = Other.m_value;
this->m_value = Other.m_value;
return *this;
}
};
```
Reviewers: aaron.ballman, JonasToth, alexfh, hokein, gribozavr2
Reviewed By: aaron.ballman
Subscribers: merge_guards_bot, xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D73052
Diffstat (limited to 'llvm/lib/Analysis/CodeMetrics.cpp')
0 files changed, 0 insertions, 0 deletions