[PATCH] D141714: Fix ast print of variables with attributes
Giuliano Belinassi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 8 08:12:23 PDT 2023
giulianobelinassi added inline comments.
================
Comment at: clang/lib/AST/DeclPrinter.cpp:269-276
+static bool mustPrintOnLeftSide(attr::Kind kind) {
+ switch (kind) {
+#include "clang/Basic/AttrLeftSideMustPrintList.inc"
+ return true;
+ default:
+ return false;
+ }
----------------
aaron.ballman wrote:
> These changes have caused a new warning to show up in MSVC builds: `switch statement contains 'default' but no 'case' labels`
>
> There's a few possible ways to resolve this: tablegen the entire switch statement (so you can elide the switch if there are no case statements and just make it `return false;` in that case), or remove the switch and add it back once the .inc file is no longer empty (this is a bit fragile for my tastes), or find an attribute that needs to be marked as must print on the left so the .inc file is no longer empty.
>
> Can you look into solving this? I've not seen a bot go red from the change yet, but we do have warnings-as-error builds with MSVC (at least in downstreams) so the extra warning here is a problem.
> tablegen the entire switch statement (so you can elide the switch if there are no case statements and just make it return false; in that case)
I will do this. This would IMHO give more control to the tool generating the table, which I think should have been the original approach. In any case, I think I will be able to come up with a patch in the next hours.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141714/new/
https://reviews.llvm.org/D141714
More information about the cfe-commits
mailing list