This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Add PropagateConst from LFTS2
AbandonedPublic

Authored by jbcoe on Jan 18 2018, 2:32 AM.

Details

Summary

PropagateConst wraps a pointer-type and allows only const access to the pointee when the pointer is accessed through a const-access path. PropagateConst is useful when writing const-correct component-based classes.

PropagateConst is part of Library Fundamentals Technical Specification 2 and has been implemented in libcxx and libstdcxx. The implementation in this patch is based on my implementation from libcxx.

Diff Detail

Event Timeline

jbcoe created this revision.Jan 18 2018, 2:32 AM
grandinj added inline comments.
llvm/include/llvm/ADT/PropagateConst.h
15

experiemental -> experimental

jbcoe updated this revision to Diff 130442.Jan 18 2018, 10:24 AM

Fix typo

jbcoe marked an inline comment as done.Jan 18 2018, 10:25 AM

What is the use case within LLVM and Clang, if you have a specific use in mind?

I was planning on deferring application (some instances of unique_ptr member data) to a follow-up patch. Would you prefer that I conflate them?

jbcoe added a comment.Jan 23 2018, 5:52 AM

I'll put another patch together showing how PropagateConst might be used in llvm/clang.

jbcoe planned changes to this revision.Jan 23 2018, 5:52 AM
jbcoe abandoned this revision.Jan 8 2020, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2020, 2:52 AM
Herald added a subscriber: dexonsmith. · View Herald Transcript