llvm-project/clang/lib/Lex
Troy Johnson 10c0eca255 [clang][Lexer] Speed up HeaderSearch when there are many HeaderMaps
HeaderSearch already uses a caching system to avoid duplicate searches,
but the initial cold miss can take a long time if a build system has
supplied thousands of HeaderMaps. For this case, the SearchDirs vector
begins with those HeaderMaps, so a cache miss requires testing if the
sought filename is present in each of those maps. Instead, we can
consolidate the keys of those HeaderMaps into one StringMap and then
each cache miss can skip directly to the correct HeaderMap or continue
its search beyond the initial sequence of HeaderMaps. In testing on TUs
with ~15000 SearchDirs where the initial 99% are HeaderMaps, time spent
in Clang was reduced by 15%. This patch is expected to be neutral for
SearchDir vectors that do not begin with HeaderMaps.

Differential Revision: https://reviews.llvm.org/D135801
2022-10-18 08:21:14 -07:00
..
CMakeLists.txt [Tooling/DependencyScanning] Rename refactorings towards transitioning dependency scanning to use pre-lexed preprocessor directive tokens 2022-05-26 12:49:51 -07:00
DependencyDirectivesScanner.cpp [Lex/DependencyDirectivesScanner] Handle the case where the source line starts with a `tok::hashhash` 2022-09-13 15:48:50 -07:00
HeaderMap.cpp [clang][lex] Remark on search path usage 2021-10-12 12:20:55 +02:00
HeaderSearch.cpp [clang][Lexer] Speed up HeaderSearch when there are many HeaderMaps 2022-10-18 08:21:14 -07:00
InitHeaderSearch.cpp [Clang][Driver] Refine/refactor DriverKit support 2022-08-26 16:06:24 -07:00
Lexer.cpp [Lex/DependencyDirectivesScanner] Keep track of the presence of tokens between the last scanned directive and EOF 2022-09-07 10:31:29 -07:00
LiteralSupport.cpp Revert "Revert "[clang][Lex] Fix a crash on malformed string literals"" 2022-10-06 11:41:18 +02:00
MacroArgs.cpp
MacroInfo.cpp [clang] Use value instead of getValue (NFC) 2022-07-13 23:39:33 -07:00
ModuleMap.cpp [clang][modules] Fix handling of `ModuleHeaderRole::ExcludedHeader` 2022-10-06 16:20:24 -07:00
PPCaching.cpp [clang] Introduce SourceLocation::[U]IntTy typedefs. 2021-07-21 10:45:46 +01:00
PPCallbacks.cpp
PPConditionalDirectiveRecord.cpp Add support for #elifdef and #elifndef 2021-05-27 08:57:47 -04:00
PPDirectives.cpp [clang][modules] Fix handling of `ModuleHeaderRole::ExcludedHeader` 2022-10-06 16:20:24 -07:00
PPExpressions.cpp [clang][preprocessor] Fix unsigned-ness of utf8 char literals 2022-05-13 07:57:10 +02:00
PPLexerChange.cpp [Lex] Introduce `PPCallbacks::LexedFileChanged()` preprocessor callback 2022-07-01 14:22:31 -07:00
PPMacroExpansion.cpp [Frontend] Recognize environment variable SOURCE_DATE_EPOCH 2022-10-12 11:55:27 -07:00
Pragma.cpp [NFC][Clang][Pragma] Remove unused variables 2022-04-24 14:50:59 +08:00
PreprocessingRecord.cpp [clang] Use value instead of getValue (NFC) 2022-07-13 23:39:33 -07:00
Preprocessor.cpp [clang][deps] Report module map describing compiled module 2022-09-22 12:06:02 -07:00
PreprocessorLexer.cpp [clang][lex] NFC: Use FileEntryRef in PreprocessorLexer::getFileEntry() 2022-04-15 15:16:17 +02:00
ScratchBuffer.cpp SourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable, NFC 2020-10-23 13:22:47 -04:00
TokenConcatenation.cpp [clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 09:12:46 -07:00
TokenLexer.cpp [TokenLexer][NFC] Rename the InstLoc to ExpandLoc 2022-10-11 21:34:22 +02:00
UnicodeCharSets.h Update Unicode to 15.0 2022-09-22 05:03:01 +02:00