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); }
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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits