[PATCH] D126832: [clang][tablegen] adds human documentation to `WarningOption`
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 8 08:58:17 PDT 2022
aaron.ballman added a comment.
In D126832#3554816 <https://reviews.llvm.org/D126832#3554816>, @cjdb wrote:
> In D126832#3553569 <https://reviews.llvm.org/D126832#3553569>, @aaron.ballman wrote:
>
>> Can you post some examples of the output from this option so we can see what the end results look like more easily?
>
> Right now this doesn't do anything at all, except feed the documentation from tablegen to Clang. It's just taking the text (represented by `...`) from `code Documentation [{...}]`, trimming any surrounding spaces, and putting that into `DIAG_ENTRY`.
>
> e.g.
>
> code Documentation [{
> Hello, world!
>
> Goodbye, world!
> }]
>
> would be forwarded as `"Hello, world!\n\n Goodbye, world!"`
Thanks, that helps me to visualize what's going on. Any thoughts on how we could test this functionality, or are we going to assume that the testing comes from its usage when we actually make use of the new information threaded in?
================
Comment at: clang/lib/Basic/DiagnosticIDs.cpp:628
+/// getDocumentation Given a diagnostic group ID, return its documentation.
+StringRef DiagnosticIDs::getWarningOptionDocumentation(diag::Group Group) {
----------------
================
Comment at: clang/utils/TableGen/ClangDiagnosticsEmitter.cpp:1550-1553
+ if (!Documentation.empty())
+ OS << "R\"(" << StringRef(Documentation).trim() << ")\"";
+ else
+ OS << R"("")";
----------------
Isn't this functionally equivalent? (It means we're using a raw empty string rather than a normal empty string, but that shouldn't matter.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126832/new/
https://reviews.llvm.org/D126832
More information about the cfe-commits
mailing list