[clang] [clang-format] Correctly annotate static overloaded operator calls (PR #161944)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 20:21:10 PDT 2025


================
@@ -3802,7 +3802,7 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts,
   const auto *Prev = Current.getPreviousNonComment();
   assert(Prev);
 
-  if (Prev->is(tok::coloncolon))
+  if (Prev->is(tok::coloncolon) && Prev->hasWhitespaceBefore())
----------------
owenca wrote:

`::operator` preceded by a `tok::identifier` can very well be a function decl. See e.g. `Out ::operator<<(` in [here](https://godbolt.org/z/s18r5oxnG).

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


More information about the cfe-commits mailing list