[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
Loading
Please register or sign in to comment