[PATCH] D46740: [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 10 21:06:40 PDT 2018


EricWF created this revision.
EricWF added reviewers: rsmith, rjmccall, aaron.ballman.
Herald added a reviewer: a.sidorin.

There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. However, Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now!

This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted.

Thoughts?

I'll add tests once there is consensus that this change should proceed.


Repository:
  rC Clang

https://reviews.llvm.org/D46740

Files:
  include/clang/Basic/Diagnostic.td
  include/clang/Basic/DiagnosticSemaKinds.td
  utils/TableGen/ClangDiagnosticsEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46740.146277.patch
Type: text/x-patch
Size: 19636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180511/7bde6723/attachment-0001.bin>


More information about the cfe-commits mailing list