[clang] [clang][Sema] Add diagnostic note for reference of function-like macros requiring without parentheses (PR #123495)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 02:24:34 PST 2025


StarOne01 wrote:

I did find what was wrong

When we try to correct typos, we seem to do it by looking over all the identifiers in the Context which includes the **typo itself!**

```cpp
// clang/lib/Sema/SemaLookup.cpp
for (const auto &I : Context.Idents)
    Consumer->FoundName(I.getKey());
```
as the typo and the correction (the typo too) are identical, **a correction is added**. 

- This always happen if a typo is encountered.

To avoid this, i tried to check for identical identifiers, but in some cases identical identifiers are a necessary correction too for example when:  

- a unqualified identifier without the nested namespace.
- a member call without it's obj, etc...

because of this ambiguity, the ` *out` is always defined and non-empty when a typo is encountered, which is our problem here.

i'm stuck, any help with fixing it would be appreciated!

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


More information about the cfe-commits mailing list