================
@@ -191,43 +190,38 @@ void 
UppercaseLiteralSuffixCheck::registerMatchers(MatchFinder *Finder) {
   // Sadly, we can't check whether the literal has suffix or not.
   // E.g. i32 suffix still results in 'BuiltinType::Kind::Int'.
   // And such an info is not stored in the *Literal itself.
-  Finder->addMatcher(
-      stmt(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
-                  floatLiteral().bind(FloatingLiteralCheck::Name)),
-           unless(anyOf(hasParent(userDefinedLiteral()),
-                        hasAncestor(substNonTypeTemplateParmExpr())))),
-      this);
+
+  Finder->addMatcher(userDefinedLiteral().bind("expr"), this);
+  Finder->addMatcher(integerLiteral().bind("expr"), this);
+  Finder->addMatcher(floatLiteral().bind("expr"), this);
 }
 
-template <typename LiteralType>
-bool UppercaseLiteralSuffixCheck::checkBoundMatch(
+void UppercaseLiteralSuffixCheck::check(
     const MatchFinder::MatchResult &Result) {
-  const auto *Literal =
-      Result.Nodes.getNodeAs<typename LiteralType::type>(LiteralType::Name);
-  if (!Literal)
-    return false;
+  const auto *const Literal = Result.Nodes.getNodeAs<Expr>("expr");
+  if (isa<UserDefinedLiteral>(Literal)) {
+    LatestUserDefinedLiteralLoc = Literal->getBeginLoc();
+    return;
+  }
+  if (Literal->getBeginLoc() == LatestUserDefinedLiteralLoc)
+    return;
----------------
localspook wrote:

Added a comment

https://github.com/llvm/llvm-project/pull/178149
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to