[clang] [clang-format] Don't insert a space between :: and * (PR #105043)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 19:04:19 PDT 2024


================
@@ -4591,7 +4589,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
     if (!BeforeLeft)
       return false;
     if (BeforeLeft->is(tok::coloncolon)) {
-      return Left.is(tok::star) &&
+      const auto *Prev = BeforeLeft->Previous;
+      return Left.is(tok::star) && Prev &&
+             !Prev->endsSequence(tok::identifier, TT_FunctionTypeLParen) &&
----------------
owenca wrote:

I had thought about adding a loop to handle the nested-name-specifier but decided to wait until we ran into code like the example you gave above in practice. Let me know if you strongly feel that we should handle it now.

https://github.com/llvm/llvm-project/pull/105043


More information about the cfe-commits mailing list