[PATCH] D53723: [clang-tidy] UppercaseLiteralSuffixCheck: bugfix: ignore implicit code
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 25 11:54:26 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun.
lebedev.ri added a project: clang-tools-extra.
Herald added a subscriber: rnkovacs.
lebedev.ri added a dependency: D53719: [clang-tidy] UppercaseLiteralSuffixCheck: bugfix: don't cripple substNonTypeTemplateParmExpr.
The previous, clearly broken output:
/tmp/test.cpp:13:15: warning: integer literal has suffix 'le', which is not uppercase [hicpp-uppercase-literal-suffix]
for (auto i : table) {
^ ~~
LE
I'm so so sad that i'm only now discovering this brokenness.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53723
Files:
clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
Index: test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
===================================================================
--- test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
+++ test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
@@ -251,3 +251,9 @@
void actual_template_test() {
template_test<4>();
}
+
+const int table[6] = {};
+void read_test() {
+ for (auto i : table) {
+ }
+}
Index: clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
===================================================================
--- clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
+++ clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
@@ -198,7 +198,8 @@
Finder->addMatcher(
stmt(allOf(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
floatLiteral().bind(FloatingLiteralCheck::Name)),
- unless(anyOf(hasParent(userDefinedLiteral()),
+ unless(anyOf(hasAncestor(isImplicit()),
+ hasParent(userDefinedLiteral()),
hasParent(substNonTypeTemplateParmExpr()))))),
this);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53723.171156.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181025/74c1fa1b/attachment.bin>
More information about the cfe-commits
mailing list