[PATCH] D91047: Add a call super attribute plugin example
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 18 08:52:19 PST 2020
aaron.ballman added inline comments.
================
Comment at: clang/docs/ClangPlugins.rst:116
+Defining CallSuperAttr
+======================
----------------
psionic12 wrote:
> After a whole day's research of `Sphinx`, I figured out that `ClangPlugins.rst` is the "proto-type" of https://clang.llvm.org/docs/ClangPlugins.html, which is the document on how to use Clang plugin features.
>
> This leads that my change in `ClangPlugins.rst` are not very appropriate, sort of off-topic.
>
> Sorry I don't notice the rest of the file, and misunderstood it as a documents for examples.
>
> I decide to move the illustration to the source code.
You're correct that the .rst file is the prototype for the public HTML documentation, sorry for not making that more clear sooner. I think it's fine to have the documentation either in the header file (as you've switched to) or within this file (since it is showing a slightly different way to define a plugin-based attribute).
================
Comment at: clang/test/Frontend/plugin-call-super.cpp:5
+
+#ifndef BAD_CALLSUPER
+// expected-no-diagnostics
----------------
Rather than duplicating the test logic like this, you can pass a custom prefix to `-verify` that gets used when checking the expected results. e.g.,
```
// RUN: %clang ... -verify=callsuper ...
// RUN: %clang ... -verify=nocallsuper -DBAD_CALLSUPER ...
// callsuper-no-diagnostics
...
void Derive::Test() { // nocallsuper-expected-warning {{virtual function ... }}
Base1::Test();
#ifndef BAD_CALLSUPER
Base2::Test();
#endif
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91047/new/
https://reviews.llvm.org/D91047
More information about the cfe-commits
mailing list