This is an archive of the discontinued LLVM Phabricator instance.

clang/Basic: Remove SourceManager::getBufferPointer, NFC
ClosedPublic

Authored by dexonsmith on Oct 14 2020, 3:22 PM.

Details

Summary

Inline Source::getBufferPointer into its only remaining caller,
getBufferOrNone. No functionality change.

Diff Detail

Event Timeline

dexonsmith created this revision.Oct 14 2020, 3:22 PM
JDevlieghere accepted this revision.Oct 19 2020, 12:14 PM

LGTM

clang/lib/Basic/SourceManager.cpp
167

Orthogonal to this patch but an idea for a follow-up: this seems lightly error prone and repetitive. We could put it in an llvm::scope_exit and then release it before the final return on line 200.

This revision is now accepted and ready to land.Oct 19 2020, 12:14 PM

Thanks for the review!

clang/lib/Basic/SourceManager.cpp
167

Good call; I refactored this a bit in https://reviews.llvm.org/D89431; after that lands I'll do what you suggest, or possibly start with IsBufferInvalid = true and then set it back to false at the end of the function (once we know it's good).

Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 3:03 PM