aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-16 14:39:28 -0400
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-26 15:38:13 -0400
commit22e6b1863e74136908842d71b4f942313d89b273 (patch)
treecb13bf2306bae0716e6046e313b41c1979ba412c /clang/lib/Basic/SourceManager.cpp
parent139785dc98ae94717eebaed083eeaad5d775b495 (diff)
downloadllvm-22e6b1863e74136908842d71b4f942313d89b273.zip
llvm-22e6b1863e74136908842d71b4f942313d89b273.tar.gz
llvm-22e6b1863e74136908842d71b4f942313d89b273.tar.bz2
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
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 2ceb804..6eae0f0 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -1734,7 +1734,7 @@ void SourceManager::computeMacroArgsCache(MacroArgsMap &MacroArgsCache,
// Predefined header doesn't have a valid include location in main
// file, but any files created by it should still be skipped when
// computing macro args expanded in the main file.
- (FID == MainFileID && Entry.getFile().Filename == "<built-in>");
+ (FID == MainFileID && Entry.getFile().getName() == "<built-in>");
if (IncludedInFID) {
// Skip the files/macros of the #include'd file, we only care about
// macros that lexed macro arguments from our file.