-W[tab] will autocomplete warnings defined in this link:
https://clang.llvm.org/docs/DiagnosticsReference.html#wweak-vtables
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang/include/clang/Basic/DiagnosticIDs.h | ||
---|---|---|
266 ↗ | (On Diff #106750) | Please write a function comment just like other member functions in this class. |
clang/lib/Basic/DiagnosticIDs.cpp | ||
514 ↗ | (On Diff #106750) | res -> Res |
515 ↗ | (On Diff #106750) | size_t is more precise than int, even though sizeof(DiagGroupNames) in reality fits in an int. |
516–517 ↗ | (On Diff #106750) | If you want to construct a string, you can do this std::string Diag(DiagGroupNames + i + 1, DiagGroupNames[i]); |
519–522 ↗ | (On Diff #106750) | I think you can remove these temporary variables: res.push_back("-W" + Diag); res.push_back("-Wno" + Diag); |
clang/lib/Driver/Driver.cpp | ||
1279 ↗ | (On Diff #106750) | Let's avoid copy: std::string -> StringRef |
It seems the code doesn't compile in clang because on your platform std::vector is implicitly included by some header, on clang+Arch however it isn`t (see the error at the end of https://teemperor.de/ccir/D35447).
clang/lib/Driver/Driver.cpp | ||
---|---|---|
1279 ↗ | (On Diff #106750) | Could you document why we had to do it this way and can't reuse the normal flags? Maybe even add a TODO: because it would be nice project for someone to refactor this into one data structure. |
@teemperor
I forgot to include <vector> in DiagnosticIDs, thanks!
What do you mean reuse the normal flags ?
Do you think we should define these -W<warnings> in Options.td like other flags?
@yamaguchi yes, the reason why we have to treat the -W... flags specially should be documented (as they're not in the OptTable as you said). E.g. something like // We have to query the -W flags manually as they're not in the OptTable. and then maybe a TODO: Find a good way to add them to OptTable instead and them remove this code..
I have a last request in my inline comment regarding the documentation, otherwise this is good to go. Nice work!
clang/include/clang/Basic/DiagnosticIDs.h | ||
---|---|---|
267 ↗ | (On Diff #106774) | Let's add an example to make it clear that we want to have the command line flags here, something like this: /// \brief Get the list of all diagnostic flags. /// \returns A list of all diagnostics flags as they would be written in a command line invocation /// including their `no-` variants. For example: `{"-Wempty-body", "-Wno-empty-body", ...}` |
LGTM
clang/lib/Driver/Driver.cpp | ||
---|---|---|
1283 ↗ | (On Diff #106774) | nit: StringRef(S) -> S as S is already a StringRef. |