[PATCH] D130847: [clang] SourceManager: fix isOffsetInFileID for the case of a fake SLocEntry
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 1 07:51:39 PDT 2022
aaron.ballman added a comment.
Thanks for working on this!
I think the same is true for `SourceManager::isInFileID()` as well, right? (Or any other place that calls `getSLocEntry()` and doesn't check whether the entry is invalid, which also seems to happen a fair amount in SourceManager.cpp.)
Given that this code is on the hot path, should it be the caller's responsibility to have already validated the `FileID` that's passed in so that the fake entry can never be returned? If not and we really do need the extra branch here (and potentially elsewhere), I'd like to see how this impacts compile time performance on something like http://llvm-compile-time-tracker.com/ to know what we're signing up for.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits