llvm-project/clang/lib/Frontend
Erik Verbruggen 2c7c38d9bb 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,
25000) 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
2017-02-16 09:49:30 +00:00
..
Rewrite Pass a char instead of a string to the find function. clang-tidy: performance-faster-string-find 2017-01-28 13:36:34 +00:00
ASTConsumers.cpp Handle StaticAssertDecl in DeclContextPrinter 2017-01-03 12:16:02 +00:00
ASTMerge.cpp [Frontend] Make the memory management of FrontendAction pointers explicit by using unique_ptr. 2016-02-07 19:28:36 +00:00
ASTUnit.cpp Cache FileID when translating diagnostics in PCH files 2017-02-16 09:49:30 +00:00
CMakeLists.txt clangFrontend: Make intrinsics_gen optional for standalone build. 2016-06-02 20:24:07 +00:00
CacheTokens.cpp Fix the build with MSVC 2013 after r283856 2016-10-11 17:24:09 +00:00
ChainedDiagnosticConsumer.cpp
ChainedIncludesSource.cpp Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer" 2017-01-06 19:49:01 +00:00
CodeGenOptions.cpp revert SVN r265702, r265640 2016-04-08 16:52:00 +00:00
CompilerInstance.cpp Modules: Simplify CompilerInstance constructor, NFC 2017-02-02 05:09:51 +00:00
CompilerInvocation.cpp Stop asserting when a meaningless -std= flag is passed for a non-compilation 2017-02-14 23:41:38 +00:00
CreateInvocationFromCommandLine.cpp Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer" 2017-01-06 19:49:01 +00:00
DependencyFile.cpp Fix PR31644 introduced by r287138 and add a regression test. 2017-01-14 21:12:08 +00:00
DependencyGraph.cpp Revert r240270 ("Fixed/added namespace ending comments using clang-tidy"). 2015-06-22 23:07:51 +00:00
DiagnosticRenderer.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
FrontendAction.cpp Initialize builtins during modular codegen 2017-02-08 20:51:11 +00:00
FrontendActions.cpp PCH: fix a regression that reports a module is defined in both pch and pcm. 2017-01-09 19:20:18 +00:00
FrontendOptions.cpp C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
HeaderIncludeGen.cpp [Frontend] StringRefize and fix bad indentation. 2016-05-27 12:52:19 +00:00
InitHeaderSearch.cpp [Frontend] Fix an issue where a quoted search path is incorrectly 2016-12-02 09:51:51 +00:00
InitPreprocessor.cpp [c++1z] Add some more tests for class template argument deduction, add 2017-02-14 00:55:25 +00:00
LangStandards.cpp
LayoutOverrideSource.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 19:38:18 +00:00
LogDiagnosticPrinter.cpp Replace double negation of !FileID.isInvalid() with FileID.isValid(). 2015-10-03 10:46:20 +00:00
ModuleDependencyCollector.cpp [CrashReproducer] Add support for merging -ivfsoverlay 2016-12-22 07:06:03 +00:00
MultiplexConsumer.cpp PR29097: add an update record when we instantiate the default member 2016-08-24 21:25:37 +00:00
PCHContainerOperations.cpp Bitcode: Decouple block info block state from reader. 2016-11-08 04:17:11 +00:00
PrintPreprocessedOutput.cpp [Preprocessor] Support for '-dI' flag 2016-11-17 22:45:31 +00:00
SerializedDiagnosticPrinter.cpp Move SerializedDiagnosticPrinter's SharedState to std::shared_ptr rather than IntrusiveRefCntPtr 2017-01-05 19:48:10 +00:00
SerializedDiagnosticReader.cpp Bitcode: Decouple block info block state from reader. 2016-11-08 04:17:11 +00:00
TestModuleFileExtension.cpp Fix for LLVM Bitcode API change (to use std::shared_ptr) 2017-01-04 22:36:43 +00:00
TestModuleFileExtension.h Module file extensions: pass a Sema through to the extension writer. 2015-12-08 22:43:32 +00:00
TextDiagnostic.cpp Move UTF functions into namespace llvm. 2016-09-30 00:38:45 +00:00
TextDiagnosticBuffer.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:42:19 +00:00
TextDiagnosticPrinter.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
VerifyDiagnosticConsumer.cpp Instead of resetting the pointer, or releasing it which was the previous 2016-11-03 18:03:14 +00:00