This is an archive of the discontinued LLVM Phabricator instance.

SourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable, NFC
ClosedPublic

Authored by dexonsmith on Oct 21 2020, 2:50 PM.

Details

Summary

Avoid some noisy const_casts by making ContentCache::SourceLineCache
and SourceManager::LastLineNoContentCache both mutable.

Diff Detail

Event Timeline

dexonsmith created this revision.Oct 21 2020, 2:50 PM

Note that this was in response to Shafik's comment in https://reviews.llvm.org/D89554.

shafik accepted this revision.Oct 21 2020, 8:32 PM

LGTM, this feels cleaner.

clang/include/clang/Basic/SourceManager.h
722

Maybe to clarify that the mutable applies to the pointer and not the const SrcMgr::ContentCache:

using ConstContentCache = const SrcMgr::ContentCache;
mutable ConstContentCache *LastLineNoContentCache;

debatable.

This revision is now accepted and ready to land.Oct 21 2020, 8:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2020, 10:22 AM