[PATCH] D76424: [AST] Use TypeDependence bitfield to calculate dependence on Types. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 14:50:02 PDT 2020


sammccall added inline comments.


================
Comment at: clang/include/clang/AST/Type.h:2882
-              Pointee->isInstantiationDependentType()),
-             Pointee->isVariablyModifiedType(),
-             (Cls->containsUnexpandedParameterPack() ||
----------------
hokein wrote:
> we have behavior change for VariableModified bit, now it is `Cls|Pointee` vs `Pointee` before
Good catch!


================
Comment at: clang/lib/AST/Type.cpp:3036
 
-    if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
-        epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
----------------
hokein wrote:
> when converting an ExprDep to TypeDep, we simply drop the value-dependent bit, so here we will not set the instantiation-bit for typeDep if  NoexceptExpr is value dependent but not instantiation-dependent.
> if NoexceptExpr is value dependent but not instantiation-dependent.

This never happens - value-dependence implies instantiation-dependence.
(I'm not sure instantiation-dependence is a concept from the standard - maybe it just affects diagnostic quality - but https://itanium-cxx-abi.github.io/cxx-abi/abi.html is referring to the same concept that clang uses.)

(Incidentally this means we could model instantiation/value/type dependence as as `unsigned : 2` - this would save a bit and make some of the logic clearer, like that "turn type to value dependence" is a downgrade)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76424





More information about the cfe-commits mailing list