[clang] [clang-format] Fix spacing before :: after non-macro identifiers (PR #189024)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 27 20:18:42 PDT 2026


================
@@ -59,6 +59,21 @@ static bool canBeObjCSelectorComponent(const FormatToken &Tok) {
   return Tok.Tok.getIdentifierInfo();
 }
 
+/// Returns \c true if the token likely names an object-like macro.
+static bool isPossibleMacro(const FormatToken &Tok) {
----------------
Lane0218 wrote:

Thanks, updated.

I merged the heuristic into `FormatToken::isPossibleMacro(...)` and reused it in both places. For the `TokenAnnotator` use case, I added `AllowFollowingColonColon` so macro-like cases such as `ALWAYS_INLINE ::std::string` stay conservative while `T :: member` still formats as `T::member`.

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


More information about the cfe-commits mailing list