Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the patch. This seems like it'll make the check much more useful.
clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp | ||
---|---|---|
63 | Nit: we should AllowedIdentifiersRegex.reserve(AllowedIdentifiers.size()) before the loop. | |
clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h | ||
34 | I understand that we need to keep the AllowedIdentifiers member around for use in storeOptions. To avoid confusion, it might make sense to change its name to be the "less default" name (something like AllowedIdentifiersRaw), and give the vector of regexes the more intuitive name AllowedIdentifiers. That would further avoid confusion since getFailureInfoImpl in the .cpp currently refers to the vector of regexes using the name AllowedIdentifiers. Also, this should probably be const for consistency. The loop in the constructor body should arguably be moved into a helper function anyway, so this member can be initialized in the constructor initializer list. |
Except pointed out issues, looks fine.
clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp | ||
---|---|---|
64–65 | avoid double compilation of regexp. AllowedIdentifiersRegex.emplace_back(Identifier.str()); if (!AllowedIdentifiersRegex.back().isValid()) { AllowedIdentifiersRegex.pop_back(); configurationDiag("Invalid allowed identifier regex '%0'") << Identifier; } | |
clang-tools-extra/docs/ReleaseNotes.rst | ||
418–420 | Sort this entry by full check name. |
Renamed allowedIdentifiers to allowedIdentifiersRaw
Moved regex parsing to a new method
Moved entry in releaseNotes.rst
Overall looks good..
clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp | ||
---|---|---|
50 | you may remove that last one that is not valid from an AllowedIdentifiers, simply use pop_back() | |
clang-tools-extra/docs/ReleaseNotes.rst | ||
246 | Consider following current approach: "Improved the bugprone-reserved-identifier check by enhancing the AllowedIdentifiers option to support regular expressions." | |
247 | consider inserting here "check" |
I understand that we need to keep the AllowedIdentifiers member around for use in storeOptions. To avoid confusion, it might make sense to change its name to be the "less default" name (something like AllowedIdentifiersRaw), and give the vector of regexes the more intuitive name AllowedIdentifiers. That would further avoid confusion since getFailureInfoImpl in the .cpp currently refers to the vector of regexes using the name AllowedIdentifiers.
Also, this should probably be const for consistency. The loop in the constructor body should arguably be moved into a helper function anyway, so this member can be initialized in the constructor initializer list.