[all-commits] [llvm/llvm-project] aab50a: SourceManager: Use the same fake SLocEntry wheneve...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Mon Oct 26 17:58:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aab50af8c18ab2eb2149bb516c8a0993ffc5abb7
      https://github.com/llvm/llvm-project/commit/aab50af8c18ab2eb2149bb516c8a0993ffc5abb7
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2020-10-26 (Mon, 26 Oct 2020)

  Changed paths:
    M clang/include/clang/Basic/SourceManager.h
    M clang/lib/Basic/SourceManager.cpp

  Log Message:
  -----------
  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




More information about the All-commits mailing list