[PATCH] D141714: Fix ast print of variables with attributes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 07:15:39 PDT 2023


aaron.ballman added a comment.





================
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;
+  }
----------------
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.


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