Boost the efficiency of SourceManager::getMacroArgExpandedLocation.
Currently getMacroArgExpandedLocation is very inefficient and for the case of a location pointing at the main file it will end up checking almost all of the SLocEntries. Make it faster: -Use a map of macro argument chunks to their expanded source location. The map is for a single source file, it's stored in the file's ContentCache and lazily computed, like the source lines cache. -In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track of the number of FileIDs (files and macros) that were created during preprocessing of that particular file SLocEntry. This is useful when computing the macro argument map in skipping included files while scanning for macro arg FileIDs that lexed from a specific source file. Due to padding, the new field does not increase the size of SLocEntry. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138225 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/SourceManager.h 57 additions, 4 deletionsinclude/clang/Basic/SourceManager.h
- include/clang/Lex/PreprocessorLexer.h 10 additions, 4 deletionsinclude/clang/Lex/PreprocessorLexer.h
- lib/Basic/SourceManager.cpp 101 additions, 39 deletionslib/Basic/SourceManager.cpp
- lib/Lex/PPLexerChange.cpp 10 additions, 0 deletionslib/Lex/PPLexerChange.cpp
- lib/Lex/PreprocessorLexer.cpp 8 additions, 0 deletionslib/Lex/PreprocessorLexer.cpp
- lib/Serialization/ASTReader.cpp 4 additions, 2 deletionslib/Serialization/ASTReader.cpp
- lib/Serialization/ASTWriter.cpp 3 additions, 0 deletionslib/Serialization/ASTWriter.cpp
Loading
Please register or sign in to comment