llvm-project/clang-tools-extra/clang-tidy/readability
Nathan James 82ddae061b [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
2020-05-09 16:21:49 +01:00
..
AvoidConstParamsInDecls.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AvoidConstParamsInDecls.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
BracesAroundStatementsCheck.cpp [clang-tidy] Fix "expression is redundant [misc-redundant-expression]" warning. NFCI. (PR44768) 2020-02-04 21:36:50 +00:00
BracesAroundStatementsCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
CMakeLists.txt [OpenMP] "UnFix" layering problem with FrontendOpenMP 2020-04-07 14:41:18 -05:00
ConstReturnTypeCheck.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
ConstReturnTypeCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ContainerSizeEmptyCheck.cpp [NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers 2020-03-10 00:42:21 +00:00
ContainerSizeEmptyCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ConvertMemberFunctionsToStatic.cpp Remove \brief commands from doxygen comments. 2019-08-22 11:32:57 +00:00
ConvertMemberFunctionsToStatic.h [clang-tidy] initial version of readability-convert-member-functions-to-static 2019-07-16 21:19:00 +00:00
DeleteNullPointerCheck.cpp DeleteNullPointerCheck now deletes until the end brace of the condition. 2019-05-26 17:00:38 +00:00
DeleteNullPointerCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
DeletedDefaultCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeletedDefaultCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ElseAfterReturnCheck.cpp [clang-tidy] Fixed crash 44745 in readability-else-after-return 2020-02-02 14:04:46 +00:00
ElseAfterReturnCheck.h Handle init statements in readability-else-after-return 2020-01-02 13:39:27 -05:00
FunctionSizeCheck.cpp Fix file headers. NFC 2019-03-01 09:52:53 +00:00
FunctionSizeCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
IdentifierNamingCheck.cpp [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved 2020-05-09 16:21:49 +01:00
IdentifierNamingCheck.h [clang-tidy] readability-identifier-naming disregards parameters restrictions on main like functions 2020-01-27 23:47:51 +00:00
ImplicitBoolConversionCheck.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
ImplicitBoolConversionCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
InconsistentDeclarationParameterNameCheck.cpp NFC: Fix trivial typos in comments 2020-01-04 10:28:41 -05:00
InconsistentDeclarationParameterNameCheck.h [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
IsolateDeclarationCheck.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
IsolateDeclarationCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
MagicNumbersCheck.cpp [APFloat] Fix checked error assert failures 2020-01-09 09:42:32 +02:00
MagicNumbersCheck.h Optionally exclude bitfield definitions from magic numbers check 2019-12-07 12:33:10 -05:00
MakeMemberFunctionConstCheck.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
MakeMemberFunctionConstCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
MisleadingIndentationCheck.cpp [clang-tidy] Disable match on `if constexpr` statements in template instantiation for `readability-misleading-indentation` check. 2020-01-08 16:36:13 +02:00
MisleadingIndentationCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
MisplacedArrayIndexCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MisplacedArrayIndexCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
NamedParameterCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
NamedParameterCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
NamespaceCommentCheck.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
NamespaceCommentCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
NonConstParameterCheck.cpp [NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers 2020-03-10 00:42:21 +00:00
NonConstParameterCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
QualifiedAutoCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
QualifiedAutoCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ReadabilityTidyModule.cpp Added readability-qualified-auto check 2020-01-14 14:06:46 -05:00
RedundantAccessSpecifiersCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantAccessSpecifiersCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantControlFlowCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RedundantControlFlowCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RedundantDeclarationCheck.cpp [clang-tidy] readability-redundant-declaration: fix false positive with C "extern inline" 2019-05-13 19:21:57 +00:00
RedundantDeclarationCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RedundantFunctionPtrDereferenceCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RedundantFunctionPtrDereferenceCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RedundantMemberInitCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantMemberInitCheck.h [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
RedundantPreprocessorCheck.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
RedundantPreprocessorCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RedundantSmartptrGetCheck.cpp [NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers 2020-03-10 00:42:21 +00:00
RedundantSmartptrGetCheck.h [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
RedundantStringCStrCheck.cpp [clang-tidy] Fix crash in readability-redundant-string-cstr 2020-03-31 13:27:32 +01:00
RedundantStringCStrCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantStringInitCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantStringInitCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
SimplifyBooleanExprCheck.cpp [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
SimplifyBooleanExprCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
SimplifySubscriptExprCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
SimplifySubscriptExprCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
StaticAccessedThroughInstanceCheck.cpp [clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance (bug 40544) 2019-05-14 18:23:10 +00:00
StaticAccessedThroughInstanceCheck.h Remove \brief commands from doxygen comments. 2019-08-22 11:32:57 +00:00
StaticDefinitionInAnonymousNamespaceCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StaticDefinitionInAnonymousNamespaceCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
StringCompareCheck.cpp [NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers 2020-03-10 00:42:21 +00:00
StringCompareCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UniqueptrDeleteReleaseCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UniqueptrDeleteReleaseCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UppercaseLiteralSuffixCheck.cpp [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
UppercaseLiteralSuffixCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00