forked from OSchip/llvm-project
[Lex] inferModuleFromLocation should do no work if there are no modules
getModuleContainingLocation ends up on the hot-path for typical C code which can lead to calls to getFileIDSlow. To speed this up, short circuit inferModuleFromLocation when there aren't any modules, implicit or otherwise. This shaves 4-5% build time when building the linux kernel. llvm-svn: 269687
This commit is contained in:
parent
58b794ae50
commit
7ffd0b4409
|
@ -917,6 +917,9 @@ Module *ModuleMap::inferModuleFromLocation(FullSourceLoc Loc) {
|
|||
if (Loc.isInvalid())
|
||||
return nullptr;
|
||||
|
||||
if (UmbrellaDirs.empty() && Headers.empty())
|
||||
return nullptr;
|
||||
|
||||
// Use the expansion location to determine which module we're in.
|
||||
FullSourceLoc ExpansionLoc = Loc.getExpansionLoc();
|
||||
if (!ExpansionLoc.isFileID())
|
||||
|
|
Loading…
Reference in New Issue