[PATCH] D93765: [NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 4 10:01:43 PST 2021


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some minor nits.



================
Comment at: clang/include/clang/AST/Decl.h:1078
 
-    return getStorageClass() >= SC_Auto;
+    return getStorageClass() >= StorageClass::Auto;
   }
----------------
You changed the definition of `isLegalForFunction()` to use a `switch` statement rather than use `<=` -- should this one be changed to a `switch` or the other one changed back to `<=` (or is there a reason to not be consistent)?


================
Comment at: clang/lib/Serialization/ASTReaderDecl.cpp:1416
+  VD->VarDeclBits.SClass =
+      static_cast<unsigned>(static_cast<StorageClass>(Record.readInt()));
   VD->VarDeclBits.TSCSpec = Record.readInt();
----------------
Is there a benefit to the two-layer of casts as opposed to storing the read value directly into `SClass`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93765/new/

https://reviews.llvm.org/D93765



More information about the cfe-commits mailing list