[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 Sep 7 03:38:07 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c -- clang/lib/Sema/SemaExpr.cpp clang/test/Preprocessor/macro_with_initializer_list.cpp clang/test/Sema/c23-varargs.c clang/test/Sema/typo-correction.c --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e3511823f..101b4d6d4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2559,7 +2559,7 @@ static bool diagnoseFunctionLikeMacro(Sema &SemaRef, DeclarationName Name,
if (MI && MI->isFunctionLike()) {
SemaRef.Diag(TypoLoc,
diag::err_undeclared_var_use_suggest_func_like_macro)
- << II ->getName();
+ << II->getName();
SemaRef.Diag(MI->getDefinitionLoc(),
diag::note_function_like_macro_requires_parens)
<< II->getName();
@@ -2603,8 +2603,8 @@ static void emitEmptyLookupTypoDiagnostic(
// Emit a special diagnostic for failed member lookups.
// FIXME: computing the declaration context might fail here (?)
if (Ctx)
- SemaRef.Diag(TypoLoc, diag::err_no_member) << Typo << Ctx
- << SS.getRange();
+ SemaRef.Diag(TypoLoc, diag::err_no_member)
+ << Typo << Ctx << SS.getRange();
else if (diagnoseFunctionLikeMacro(SemaRef, Typo, TypoLoc))
return;
else
@@ -2622,9 +2622,10 @@ static void emitEmptyLookupTypoDiagnostic(
SemaRef.diagnoseTypo(TC, SemaRef.PDiag(DiagnosticSuggestID) << Typo,
SemaRef.PDiag(NoteID));
else
- SemaRef.diagnoseTypo(TC, SemaRef.PDiag(diag::err_no_member_suggest)
- << Typo << Ctx << DroppedSpecifier
- << SS.getRange(),
+ SemaRef.diagnoseTypo(TC,
+ SemaRef.PDiag(diag::err_no_member_suggest)
+ << Typo << Ctx << DroppedSpecifier
+ << SS.getRange(),
SemaRef.PDiag(NoteID));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/123495
More information about the cfe-commits
mailing list