================
@@ -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())
----------------
HazardyKnusperkeks wrote:

I don't know why you always bring the up function declaration.
Before your patch:
``` c++
  auto Tokens = annotate("SomeAPI::operator()();\n"
                         "SomeAPI ::operator()();");
  EXPECT_TOKEN(Tokens[2], tok::kw_operator, TT_FunctionDeclarationName);
  EXPECT_TOKEN(Tokens[10], tok::kw_operator, TT_FunctionDeclarationName);
```

After your patch:
``` c++
  auto Tokens = annotate("SomeAPI::operator()();\n"
                         "SomeAPI ::operator()();");
  EXPECT_TOKEN(Tokens[2], tok::kw_operator, TT_Unknown);
  EXPECT_TOKEN(Tokens[10], tok::kw_operator, TT_FunctionDeclarationName);
```

It only correctly annotates the first line, with no space before the `::`.

That's all I say.

https://github.com/llvm/llvm-project/pull/161944
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to