diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2017-01-29 04:42:21 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2017-01-29 04:42:21 +0000 |
commit | 688b69adf8f2b854cf3e532adc8db20e00638736 (patch) | |
tree | 1e593d9763deb267ed1aa1ce5690093ee1f003b5 /clang/lib/Serialization/ModuleManager.cpp | |
parent | 4753736abfe807e623b0b327d32a78d23d770c08 (diff) | |
download | llvm-688b69adf8f2b854cf3e532adc8db20e00638736.zip llvm-688b69adf8f2b854cf3e532adc8db20e00638736.tar.gz llvm-688b69adf8f2b854cf3e532adc8db20e00638736.tar.bz2 |
Modules: Fix a minor performance bug from r293393
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.
llvm-svn: 293415
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 84cdd90..b7ee302 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -165,9 +165,10 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // 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. |