[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 2 02:16:22 PST 2020


ilya-biryukov marked 4 inline comments as done.
ilya-biryukov added inline comments.


================
Comment at: clang/include/clang/AST/Expr.h:126
+    if (TD)
+      D = D | DependencyFlags::Type;
+    if (VD)
----------------
Mordante wrote:
> Just curious why do you prefer `D = D | DependencyFlags::Type;` over `D |= DependencyFlags::Type;` ? The latter seems to be more common.
Would also prefer `D |=`, but it leads to compilation errors.

The builtin `operator |=` accepts ints and, therefore, fails on strongly-typed enums.
And, AFAIK, there's no way to redefine `operator |=` for non-class types.


================
Comment at: clang/include/clang/AST/Stmt.h:323
   };
   enum { NumExprBits = NumStmtBits + 9 };
 
----------------
Mordante wrote:
> Please use `enum { NumExprBits = NumStmtBits + 5 +  DependencyFlagsBits };` to avoid bugs when the size changes.
Many thanks! Using it here was the reason I wanted to add the constant in the first place. Ended up forgetting about it.
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71920





More information about the cfe-commits mailing list