[PATCH] D31501: [RFC] Integrate clang -cc1as diagnostics into DiagnosticsEngine

Sanne Wouda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 3 06:22:31 PDT 2017


sanwou01 added a comment.

Hi Oli,

Thanks for taking a look! You're right, -w and -Werror could be implemented by passing them as MCTargetOptions flags.

This patch is indeed intended to enable -W options to promote or silence (categories of) warnings. To enable that, the first step is to be able to associate a diagnostic with an identifier. Clang defines IDs (and their warning groups) in Diagnostic*Kinds.td. The IDs need to be available where a diagnostic is raised, so a table for LLVM diagnostics (or just the enum) needs to live on the LLVM side (but they'd share encoding space with the clang enum, e.g., the clang diag enum starts where the llvm diag enum ends). It is then a matter of plumbing this ID from the point where the diagnostic gets raised, into an SMDiagnostic, and into the DiagnosticsEngine on the clang side.

Once the infrastructure is in place, the calls to `Report()` and friends can be updated with IDs on a case by case basis.

Thanks,
Sanne


https://reviews.llvm.org/D31501





More information about the cfe-commits mailing list