This is an archive of the discontinued LLVM Phabricator instance.

clang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager::getBuffer)
ClosedPublic

Authored by dexonsmith on Oct 14 2020, 2:27 PM.

Details

Summary

In order to drop the final callers to SourceManager::getBuffer, change
FrontendInputFile to use Optional<MemoryBufferRef>. Also updated
the "unowned" version of SourceManager::createFileID to take a
MemoryBufferRef (it now calls MemoryBuffer::getMemBuffer, which
creates a MemoryBuffer that does not own the buffer data).

Diff Detail

Event Timeline

dexonsmith created this revision.Oct 14 2020, 2:27 PM
dexonsmith requested review of this revision.Oct 14 2020, 2:27 PM

Adding a couple of changes I forgot to stage (remove now-unused UnownedTag and a minor simplification to createFileID).

arphaman accepted this revision.Oct 19 2020, 9:43 PM
This revision is now accepted and ready to land.Oct 19 2020, 9:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 10:36 AM