[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
Mon Jan 20 08:35:25 PST 2025


================
@@ -2509,6 +2509,20 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
     DC = DC->getLookupParent();
   }
 
+  // Check whether a similar function-like macro exists and suggest it
----------------
StarOne01 wrote:

Hey, thanks for asking, let me explain myself.

If i understand it right, [that particular conditional statement](https://github.com/llvm/llvm-project/blob/main/clang%2Flib%2FSema%2FSemaExpr.cpp#L2525-L2526) should get executed for this:

```c
int main(){
    int var1 = 63;
    int out = var;
}
```
and should be skipped for:

```c
int main(){
    int var1 = 63;
    int out = notFound;
}
```

but the problem is that the conditional statement gets executed for **both the cases**, so when i put the new check somewhere below it, the control _never_ reaches the new check.

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


More information about the cfe-commits mailing list