This is an archive of the discontinued LLVM Phabricator instance.

[AST] Use TypeDependence bitfield to calculate dependence on Types. NFC
ClosedPublic

Authored by sammccall on Mar 19 2020, 3:58 AM.

Details

Summary

This clears the way for adding an Error dependence bit to Type and having it
mostly-automatically propagated.

Diff Detail

Event Timeline

sammccall created this revision.Mar 19 2020, 3:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2020, 3:58 AM

This mostly corresponds to the Expr refactoring in ec3060c72de6ab6992269318d92764199856e5fe, without the followup moving it to ComputeDependence yet.

I used a constructor param to assist in the refactoring and because most cases are really simple.

hokein added inline comments.Mar 19 2020, 6:24 AM
clang/include/clang/AST/Type.h
2882

we have behavior change for VariableModified bit, now it is Cls|Pointee vs Pointee before

clang/include/clang/AST/TypeProperties.td
462

nit: the line length seems > 80 columns.

clang/lib/AST/Type.cpp
3036

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.

sammccall updated this revision to Diff 251478.Mar 19 2020, 2:30 PM
sammccall marked 5 inline comments as done.

Address comments

clang/include/clang/AST/Type.h
2882

Good catch!

clang/lib/AST/Type.cpp
3036

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)

hokein accepted this revision.Mar 20 2020, 12:10 AM

Thanks.

clang/lib/AST/Type.cpp
3036

ah, right. I missed the fact that value-dependence implies instantiation-dependence when reading the code.

This revision is now accepted and ready to land.Mar 20 2020, 12:10 AM
This revision was automatically updated to reflect the committed changes.