]> granicus.if.org Git - clang/commit
Boost the efficiency of SourceManager::getMacroArgExpandedLocation.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 21 Aug 2011 23:33:04 +0000 (23:33 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 21 Aug 2011 23:33:04 +0000 (23:33 +0000)
commitd9d2b679d0728ea7f539f38aaea38e26b8b08043
tree3d48a007cab31b6bfacd3e8f03d1271da7fe3b1f
parent76c506fba2359296d1f19e64998bd11d7b864563
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
include/clang/Basic/SourceManager.h
include/clang/Lex/PreprocessorLexer.h
lib/Basic/SourceManager.cpp
lib/Lex/PPLexerChange.cpp
lib/Lex/PreprocessorLexer.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp