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

Ben Dunkin via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 10:23:21 PST 2026


================
@@ -3669,12 +3718,11 @@ static FormatToken *getFunctionName(const AnnotatedLine &Line,
     }
 
     // Skip to the unqualified part of the name.
-    while (Tok->startsSequence(tok::identifier, tok::coloncolon)) {
-      assert(Tok->Next);
-      Tok = Tok->Next->Next;
-      if (!Tok)
-        return nullptr;
-    }
+    while (FormatToken *Next = skipNameQualifier(Tok))
+      Tok = Next;
+
+    if (!Tok)
+      return nullptr;
----------------
bdunkin wrote:

This comment was made on a previous commit that has since been force pushed over. The check it mentioned was removed, and this comment is now pointing to a different, necessary check. Without this check, the next line might try to call a function on a nullptr.

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


More information about the cfe-commits mailing list