SourceManager: Use the same fake SLocEntry whenever it fails to load
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Oct 2020 22:30:49 +0000 (18:30 -0400)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 27 Oct 2020 00:56:28 +0000 (20:56 -0400)
commitaab50af8c18ab2eb2149bb516c8a0993ffc5abb7
tree701fd435058ad0109940dab16258826c321a0fe8
parent17cdba61d4364ac7d89f6be770afdd4cc8daef83
SourceManager: Use the same fake SLocEntry whenever it fails to load

Instead of putting a fake `SLocEntry` at `LoadedSLocEntryTable[Index]`
when it fails to load in `SourceManager::loadSLocEntry`, allocate a fake
one. Unless someone is sniffing the address of the returned `SLocEntry`
(doubtful), this won't be a functionality change. Note that
`SLocEntryLoaded[Index]` wasn't being set to `true` either before or
after this change so no accessor is every going to look at
`LoadedSLocEntryTable[Index]`.

As a side effect, drop the `mutable` from `LoadedSLocEntryTable`.

Differential Revision: https://reviews.llvm.org/D89748
clang/include/clang/Basic/SourceManager.h
clang/lib/Basic/SourceManager.cpp