[clang] [clang-format] Handle templates in qualified typenames (PR #143194)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 12 01:57:48 PDT 2025


================
@@ -3622,6 +3622,29 @@ static unsigned maxNestingDepth(const AnnotatedLine &Line) {
   return Result;
 }
 
+static bool startsQualifiedName(const FormatToken *Tok) {
+  // Consider:       A::B::B()
+  //           Tok --^
+  if (Tok->startsSequence(tok::identifier, tok::coloncolon))
+    return true;
+
+  // Consider:       A<float>::B<int>::B()
+  //           Tok --^
+  if (Tok->startsSequence(tok::identifier, TT_TemplateOpener)) {
+    Tok = Tok->getNextNonComment();
+    assert(Tok);
----------------
HazardyKnusperkeks wrote:

I think you can drop the asserts.

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


More information about the cfe-commits mailing list