[Modules] In case of lock timeout, fallback and build module

Duncan's r298165 introduced the PCMCache mechanism, which guarantees
that locks aren't necessary anymore for correctness but only for
performance, by avoiding building it twice when possible.

Change the logic to avoid an error but actually build the module in case
the timeout happens. Instead of an error, still emit a remark for
debugging purposes.

rdar://problem/30297862

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298175 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit a034154895369927407fd67c361eb86eef7316ba)

 Conflicts:
	include/clang/Basic/DiagnosticCommonKinds.td
	lib/Frontend/CompilerInstance.cpp
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index af0f94b..6f37cdb 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -1213,11 +1213,11 @@
     switch (Locked) {
     case llvm::LockFileManager::LFS_Error:
       // PCMCache takes care of correctness and locks are only necessary for
-      // performance. If there are errors creating the lock, do not use it
-      // and fallback to building the module ourselves.
+      // performance. Fallback to building the module in case of any lock
+      // related errors.
       Diags.Report(ModuleNameLoc, diag::remark_module_lock_failure)
           << Module->Name << Locked.getErrorMessage();
-      // Clear the lock file in case there's some leftover around.
+      // Clear out any potential leftover.
       Locked.unsafeRemoveLockFile();
       // FALLTHROUGH
     case llvm::LockFileManager::LFS_Owned:
@@ -1240,8 +1240,8 @@
         continue; // try again to get the lock.
       case llvm::LockFileManager::Res_Timeout:
         // Since PCMCache takes care of correctness, we try waiting for another
-        // process to complete the build so that this isn't done twice. If we
-        // reach a timeout, it's not a problem, try to build it ourselves then.
+        // process to complete the build so clang does not do it done twice. If
+        // case of timeout, build it ourselves.
         Diags.Report(ModuleNameLoc, diag::remark_module_lock_timeout)
             << Module->Name;
         // Clear the lock file so that future invokations can make progress.