HomePhabricator

Cache FileID when translating diagnostics in PCH files

Authored by erikjv on Feb 16 2017, 1:49 AM.

Description

Cache FileID when translating diagnostics in PCH files

Modules/preambles/PCH files can contain diagnostics, which, when used,
are added to the current ASTUnit. For that to work, they are translated
to use the current FileManager's FileIDs. When the entry is not the
main file, all local source locations will be checked by a linear
search. Now this is a problem, when there are lots of diagnostics (say,

  1. and lots of local source locations (say, 440000), and end up

taking seconds when using such a preamble.

The fix is to cache the last FileID, because many subsequent diagnostics
refer to the same file. This reduces the time spent in
ASTUnit::TranslateStoredDiagnostics from seconds to a few milliseconds
for files with many slocs/diagnostics.

This fixes PR31353.
Differential Revision: https://reviews.llvm.org/D29755

llvm-svn: 295301

Details

Committed
erikjvFeb 16 2017, 1:49 AM
Differential Revision
D29755: Cache FileID when translating diagnostics in PCH files
Parents
rG21c3d8e0fc2d: [ARM] GlobalISel: Legalize 64-bit G_FADD and G_LOAD
Branches
Unknown
Tags
Unknown