[all-commits] [llvm/llvm-project] 22e6b1: SourceManager: Fix an SLocEntry memory regression ...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Mon Oct 26 12:38:42 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 22e6b1863e74136908842d71b4f942313d89b273
      https://github.com/llvm/llvm-project/commit/22e6b1863e74136908842d71b4f942313d89b273
  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: Fix an SLocEntry memory regression introduced with FileEntryRef

4dc5573acc0d2e7c59d8bac2543eb25cb4b32984 added `FileEntryRef` in order to
help enable sharing of a `FileManager` between `CompilerInstance`s.

It also added a `StringRef` with the filename on `FileInfo`. This
doubled `sizeof(FileInfo)`, bloating `sizeof(SLocEntry)`, of which we
have one for each (loaded and unloaded) file and macro expansion. This
causes a memory regression in modules builds.

Move the filename down into the `ContentCache`, which is a side data
structure for `FileInfo` that does not impact `sizeof(SLocEntry)`. Once
`FileEntryRef` is used for `ContentCache::OrigEntry` this can go away.

Differential Revision: https://reviews.llvm.org/D89580
Radar-Id: rdar://59908826




More information about the All-commits mailing list