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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 01:59:55 PST 2020


hokein added inline comments.


================
Comment at: clang/include/clang/AST/DependencyFlags.h:57
+  struct NAME##Scope {                                                         \
+    enum NAME {                                                                \
+      UnexpandedPack = 1,                                                      \
----------------
should we make the enum as `uint8_t`  as the other `ExprDependence` above?


================
Comment at: clang/include/clang/AST/DependencyFlags.h:81
+  auto E =
+      static_cast<ExprDependence>(TA & ~TemplateArgumentDependence::Dependent);
+  if (TA & TemplateArgumentDependence::Dependent)
----------------
nit: I think we can get rid of the `static_cast`, sine we already use `LLVM_MARK_AS_BITMASK_ENUM`.


================
Comment at: clang/include/clang/AST/Type.h:1468
 
-    /// Whether this type is a dependent type (C++ [temp.dep.type]).
-    unsigned Dependent : 1;
----------------
would be nice to keep this comments in the new `TypeDependence` struct.


================
Comment at: clang/lib/AST/TemplateName.cpp:173
+TemplateNameDependence TemplateName::getDependence() const {
+  auto F = TemplateNameDependence::None;
+  if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) {
----------------
This part of refactoring seems a little scary to me,  I think it is correct by comparing with the previous version. but the getDependence() now is very **complicated**, I have no idea what it is doing.

instead of merging three different non-trivial if branches into a single function, maybe keep them as it-is.


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