Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
diff --git a/lib/Basic/MemoryBufferCache.cpp b/lib/Basic/MemoryBufferCache.cpp
index f4b751c..c1fc571 100644
--- a/lib/Basic/MemoryBufferCache.cpp
+++ b/lib/Basic/MemoryBufferCache.cpp
@@ -15,8 +15,8 @@
llvm::MemoryBuffer &
MemoryBufferCache::addBuffer(llvm::StringRef Filename,
std::unique_ptr<llvm::MemoryBuffer> Buffer) {
- auto Insertion = Buffers.insert(std::make_pair(
- Filename, BufferEntry{std::move(Buffer), NextIndex++}));
+ auto Insertion =
+ Buffers.insert({Filename, BufferEntry{std::move(Buffer), NextIndex++}});
assert(Insertion.second && "Already has a buffer");
return *Insertion.first->second.Buffer;
}
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.
diff --git a/test/Modules/outofdate-rebuild.m b/test/Modules/outofdate-rebuild.m
index e933dce..510325f 100644
--- a/test/Modules/outofdate-rebuild.m
+++ b/test/Modules/outofdate-rebuild.m
@@ -1,12 +1,15 @@
// RUN: rm -rf %t.cache
// RUN: echo "@import CoreText;" > %t.m
-// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild %s -fsyntax-only -Rmodule-build
-// RUN: echo -----------------------------------------------
-// RUN: %clang_cc1 -DMISMATCH -Werror -fdisable-module-hash -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild %t.m -fsyntax-only -Rmodule-build
-// RUN: echo -----------------------------------------------
-// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild %s -fsyntax-only -Rmodule-build
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t.cache \
+// RUN: -fmodules -fimplicit-module-maps -I%S/Inputs/outofdate-rebuild %s \
+// RUN: -fsyntax-only
+// RUN: %clang_cc1 -DMISMATCH -Werror -fdisable-module-hash \
+// RUN: -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps \
+// RUN: -I%S/Inputs/outofdate-rebuild %t.m -fsyntax-only
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t.cache \
+// RUN: -fmodules -fimplicit-module-maps -I%S/Inputs/outofdate-rebuild %s \
+// RUN: -fsyntax-only
-// This testcase reproduces a use-after-free in
-// https://reviews.llvm.org/D28299 when ModuleManager removes an entry
-// from the PCMcache without notifying its parent ASTReader.
+// This testcase reproduces a use-after-free in when ModuleManager removes an
+// entry from the PCMCache without notifying its parent ASTReader.
@import Cocoa;
diff --git a/test/Modules/system-out-of-date-test.m b/test/Modules/system-out-of-date-test.m
index 9ce14cc..e78df7b 100644
--- a/test/Modules/system-out-of-date-test.m
+++ b/test/Modules/system-out-of-date-test.m
@@ -1,13 +1,17 @@
-// RUN: rm -rf %t
+// RUN: rm -rf %t.cache
// RUN: echo '@import X;' | \
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \
-// RUN: -fmodules-cache-path=%t -I %S/Inputs/system-out-of-date \
+// RUN: -fmodules-cache-path=%t.cache -I%S/Inputs/system-out-of-date \
// RUN: -fsyntax-only -x objective-c -
+//
+// Build something with different diagnostic options.
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \
+// RUN: -fmodules-cache-path=%t.cache -I%S/Inputs/system-out-of-date \
+// RUN: -fsyntax-only %s -Wnon-modular-include-in-framework-module \
+// RUN: -Werror=non-modular-include-in-framework-module 2>&1 \
+// RUN: | FileCheck %s
+@import X;
-// We have an version built with different diagnostic options.
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/system-out-of-date -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module %s -fsyntax-only 2>&1 | FileCheck %s
- @import X;
-
- #import <Z.h>
+#import <Z.h>
// CHECK: While building module 'Z' imported from
// CHECK: {{.*}}Y-{{.*}}pcm' was validated as a system module and is now being imported as a non-system module
diff --git a/test/Modules/warning-mismatch.m b/test/Modules/warning-mismatch.m
index 7c83664..dd7c7f8 100644
--- a/test/Modules/warning-mismatch.m
+++ b/test/Modules/warning-mismatch.m
@@ -1,9 +1,13 @@
// RUN: rm -rf %t.cache
// RUN: echo "@import Mismatch;" >%t.m
-// RUN: %clang_cc1 -Wno-system-headers -fdisable-module-hash -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps -I %S/Inputs/warning-mismatch %t.m -fsyntax-only -Rmodule-build
-// RUN: echo -----------------------------------------------
-// RUN: %clang_cc1 -Wsystem-headers -fdisable-module-hash -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps -I %S/Inputs/warning-mismatch %s -fsyntax-only -Rmodule-build
+// RUN: %clang_cc1 -Wno-system-headers -fdisable-module-hash \
+// RUN: -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps \
+// RUN: -I%S/Inputs/warning-mismatch %t.m -fsyntax-only
+// RUN: %clang_cc1 -Wsystem-headers -fdisable-module-hash \
+// RUN: -fmodules-cache-path=%t.cache -fmodules -fimplicit-module-maps \
+// RUN: -I%S/Inputs/warning-mismatch %s -fsyntax-only
-// This testcase triggers a warning flag mismatch in an already validated header.
+// This testcase triggers a warning flag mismatch in an already validated
+// header.
@import Mismatch;
@import System;