This is an archive of the discontinued LLVM Phabricator instance.

[AST] Make Expr::setDependence protected and remove add/removeDependence. NFC
ClosedPublic

Authored by sammccall on Mar 18 2020, 3:40 PM.

Details

Summary

The expected pattern is for subclasses to initialize through
computeDependence, which needs only setDependence.
The few places that still use addDependence can be simulated with get+set.

Diff Detail

Event Timeline

sammccall created this revision.Mar 18 2020, 3:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2020, 3:40 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
hokein accepted this revision.Mar 19 2020, 12:23 AM
hokein added inline comments.
clang/include/clang/AST/Expr.h
2772

the method name seems too concrete to me, I'd prefer to drop ForPostponedNameLookup, though there is only one usage in Sema.

This revision is now accepted and ready to land.Mar 19 2020, 12:23 AM
sammccall marked an inline comment as done.Mar 19 2020, 4:12 AM
sammccall added inline comments.
clang/include/clang/AST/Expr.h
2772

So the idea here is that we're breaking encapsulation for a special purpose, and this method shouldn't be generally used to manipulate dependence.
If we do want to add another usage (in sema or elsewhere) for another purpose, it makes sense to have to modify Expr (by renaming the method or adding another one), just as if this function was private.

sammccall updated this revision to Diff 251337.Mar 19 2020, 4:12 AM

Add comment on markDependentForPostponedNameLookup

This revision was automatically updated to reflect the committed changes.