llvm / llvm/llvm-project

Improve diagnostics engine handling of expansions from system macros

Open
#192,490 2 comments 0 reactions 0 assignees View on GitHub
clang:frontend code-quality
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

From discussion on a PR: https://github.com/llvm/llvm-project/pull/192481#issuecomment-4261724630

> I'd like us to come to an model for which diagnostic should or should not be produced from macro expansion and maybe add a flag to the diagnostic table so that we can deal with it in DiagnosticIDs::getDiagnosticLevel - as we do for diagnostic emitted directly from system headers.
>
> It's possible that we can only do that in limited scenario, e.g when we know no user code is involved at all. but that should cover all the lexing diagnostics.

This seems like a reasonable idea worth exploring, if someone has the time to investigate.

Contributor guide

Open the contributing guide

Research direction

Start with the linked pull request discussion and inspect DiagnosticIDs::getDiagnosticLevel, which the issue identifies as the likely integration point. Investigate how diagnostics from system macro expansions are currently handled, then define a model and diagnostic-table flag for cases where suppression is appropriate. Done means the behavior is documented, implemented for an agreed scope, and covered by relevant diagnostics tests.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.