clang driver, how it does set the diagnostic depending on the language?

dear cfe-dev,

how clang (as driver) does set the diagnostic levels depending on the

For example C89 sees BCPL's comments as an extension, C99 or C++ doesn't.

As other example trigraphs can be ignored:
In clang.cpp I can see
  if (Trigraphs.getPosition())
    Options.Trigraphs = Trigraphs;

Once Options.Trigraphs is set (for example to 0), how Diagnostic is alerted
of treating trigraphs as errors?

The clang.cpp 's function
bool InitializeLangOptions(LangOptions &Options, LangKind LK);
initialize the LangOptions object that keeps info about the language, but I
can't find how those settings interact with the diagnostic itself.

The function
void InitializeDiagnostics(Diagnostic &Diags);
does not touch language related issues.

I am pretty lost.


It doesn't. Such language-specific diagnostics are usually made conditional
at the place that calls Diag().

However, the tokenizer has its own mechanism for having language-specific
keywords and tokens.