Oops... r293393 started calling ReadSignature in
ModuleManager::addModule even when there was no ExpectedSignature.
Whether or not this would have a measurable performance impact (I
spotted this by inspection, and ReadSignature should be fairly fast), we
might as well get what we can. Add an extra check against
ExpectedSignature to avoid the hit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293415
91177308-0d34-0410-b5e6-
96231b3b80d8
// Initialize the stream.
NewModule->Data = PCHContainerRdr.ExtractPCH(*NewModule->Buffer);
- // Read the signature eagerly now so that we can check it.
- if (checkSignature(ReadSignature(NewModule->Data), ExpectedSignature,
- ErrorStr))
+ // Read the signature eagerly now so that we can check it. Avoid calling
+ // ReadSignature unless there's something to check though.
+ if (ExpectedSignature && checkSignature(ReadSignature(NewModule->Data),
+ ExpectedSignature, ErrorStr))
return OutOfDate;
// We're keeping this module. Store it everywhere.