Skip to content

Commit ecc2899

Browse files
committed
Merge remote-tracking branch 'origin/swift-5.1-branch' into stable
apple-llvm-split-commit: 537fb1fd3a8fab5c200a7b9000ab362e95449472 apple-llvm-split-dir: clang/
2 parents 9d420d8 + 729748d commit ecc2899

File tree

6 files changed

+45
-6
lines changed

6 files changed

+45
-6
lines changed

clang/lib/Serialization/ModuleManager.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,8 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type,
207207
// Read the signature eagerly now so that we can check it. Avoid calling
208208
// ReadSignature unless there's something to check though.
209209
if (ExpectedSignature && checkSignature(ReadSignature(NewModule->Data),
210-
ExpectedSignature, ErrorStr)) {
211-
// Try to remove the buffer. If it can't be removed, then it was already
212-
// validated by this process.
213-
if (!getModuleCache().tryToDropPCM(NewModule->FileName))
214-
FileMgr.invalidateCache(NewModule->File);
210+
ExpectedSignature, ErrorStr))
215211
return OutOfDate;
216-
}
217212

218213
// We're keeping this module. Store it everywhere.
219214
Module = Modules[Entry] = NewModule.get();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// A
2+
#include "Common.h"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// B
2+
#include "Common.h"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Common
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module A { header "A.h" }
2+
module B { header "B.h" }
3+
module Common { header "Common.h" }
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// REQUIRES: shell
2+
// RUN: rm -rf %t
3+
// RUN: mkdir -p %t/implicit-invalidate-common
4+
// RUN: cp -r %S/Inputs/implicit-invalidate-common %t/
5+
// RUN: echo '#include "A.h"' > %t/A.c
6+
// RUN: echo '#include "B.h"' > %t/B.c
7+
8+
// Build with an empty module cache. Module 'Common' should be built only once.
9+
//
10+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
11+
// RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
12+
// RUN: %t/A.c 2> %t/initial_build.txt
13+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
14+
// RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
15+
// RUN: %t/B.c 2>> %t/initial_build.txt
16+
// RUN: FileCheck %s --implicit-check-not "remark:" --input-file %t/initial_build.txt
17+
18+
// Update module 'Common' and build with the populated module cache. Module
19+
// 'Common' still should be built only once. Note that we are using the same
20+
// flags for A.c and B.c to avoid building Common.pcm at different paths.
21+
//
22+
// RUN: echo ' // ' >> %t/implicit-invalidate-common/Common.h
23+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
24+
// RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
25+
// RUN: %t/A.c 2> %t/incremental_build.txt
26+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
27+
// RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
28+
// RUN: %t/B.c 2>> %t/incremental_build.txt
29+
// RUN: FileCheck %s --implicit-check-not "remark:" --input-file %t/incremental_build.txt
30+
31+
// CHECK: remark: building module 'A'
32+
// CHECK: remark: building module 'Common'
33+
// CHECK: remark: finished building module 'Common'
34+
// CHECK: remark: finished building module 'A'
35+
// CHECK: remark: building module 'B'
36+
// CHECK: remark: finished building module 'B'

0 commit comments

Comments
 (0)