summaryrefslogtreecommitdiffstats
path: root/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/DebugInfo-fmodule-name.c16
-rw-r--r--test/Modules/ExtDebugInfo.cpp2
-rw-r--r--test/Modules/Inputs/Rmodule-import/A.h2
-rw-r--r--test/Modules/Inputs/Rmodule-import/B.h2
-rw-r--r--test/Modules/Inputs/Rmodule-import/C.h1
-rw-r--r--test/Modules/Inputs/Rmodule-import/D.h1
-rw-r--r--test/Modules/Inputs/Rmodule-import/module.modulemap4
-rw-r--r--test/Modules/Inputs/implicit-invalidate-chain/A.h2
-rw-r--r--test/Modules/Inputs/implicit-invalidate-chain/B.h2
-rw-r--r--test/Modules/Inputs/implicit-invalidate-chain/C.h2
-rw-r--r--test/Modules/Inputs/implicit-invalidate-chain/module.modulemap3
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/alias.h7
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/alias1.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/alias2.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/func.h7
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/func1.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/func2.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/module.modulemap24
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/strct.h7
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/strct1.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/strct2.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/var.h9
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/var1.h1
-rw-r--r--test/Modules/Inputs/nested-template-default-arg-redecl/var2.h1
-rw-r--r--test/Modules/Inputs/relative-import-path/A.h2
-rw-r--r--test/Modules/Inputs/relative-import-path/B.h2
-rw-r--r--test/Modules/Inputs/relative-import-path/C.h1
-rw-r--r--test/Modules/Inputs/relative-import-path/module.modulemap3
-rw-r--r--test/Modules/ModuleDebugInfo.cpp3
-rw-r--r--test/Modules/Rmodule-build.m4
-rw-r--r--test/Modules/Rmodule-import.m46
-rw-r--r--test/Modules/framework-name.m8
-rw-r--r--test/Modules/friend-definition-2.cpp4
-rw-r--r--test/Modules/implementation-of-module.m10
-rw-r--r--test/Modules/implicit-invalidate-chain.c67
-rw-r--r--test/Modules/initializers.cpp241
-rw-r--r--test/Modules/merge-lambdas.cpp2
-rw-r--r--test/Modules/module_file_info.m2
-rw-r--r--test/Modules/nested-template-default-arg-redecl.cpp16
-rw-r--r--test/Modules/odr_hash.cpp37
-rw-r--r--test/Modules/outofdate-rebuild.m2
-rw-r--r--test/Modules/pch_container.m4
-rw-r--r--test/Modules/relative-import-path.c26
-rw-r--r--test/Modules/templates.mm4
44 files changed, 558 insertions, 25 deletions
diff --git a/test/Modules/DebugInfo-fmodule-name.c b/test/Modules/DebugInfo-fmodule-name.c
new file mode 100644
index 0000000000..7f2730ddc9
--- /dev/null
+++ b/test/Modules/DebugInfo-fmodule-name.c
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -fmodule-name=MainA \
+// RUN: -debug-info-kind=limited -dwarf-ext-refs \
+// RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -F %S/Inputs \
+// RUN: %s -S -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
+
+#include "MainA/MainPriv.h"
+
+// CHECK: !DICompileUnit
+// CHECK-NOT: dwoId:
+
+// We still want the import, but no skeleton CU, since no PCM was built.
+
+// CHECK: !DIModule({{.*}}, name: "APriv"
+// CHECK-NOT: !DICompileUnit
+// CHECK-NOT: dwoId:
diff --git a/test/Modules/ExtDebugInfo.cpp b/test/Modules/ExtDebugInfo.cpp
index 592612b9a5..5d2921cd99 100644
--- a/test/Modules/ExtDebugInfo.cpp
+++ b/test/Modules/ExtDebugInfo.cpp
@@ -214,7 +214,7 @@ void foo() {
// CHECK-PCH: dwoId: 18446744073709551614
// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A",
-// CHECK-SAME: DIFlagFwdDecl, identifier: "_ZTS1A")
+// CHECK-SAME: DIFlagFwdDecl)
// There is a full definition of the type available in the module.
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual",
diff --git a/test/Modules/Inputs/Rmodule-import/A.h b/test/Modules/Inputs/Rmodule-import/A.h
new file mode 100644
index 0000000000..2b9dab8587
--- /dev/null
+++ b/test/Modules/Inputs/Rmodule-import/A.h
@@ -0,0 +1,2 @@
+// A
+#include "B.h"
diff --git a/test/Modules/Inputs/Rmodule-import/B.h b/test/Modules/Inputs/Rmodule-import/B.h
new file mode 100644
index 0000000000..a2711d4043
--- /dev/null
+++ b/test/Modules/Inputs/Rmodule-import/B.h
@@ -0,0 +1,2 @@
+// B
+#include "C.h"
diff --git a/test/Modules/Inputs/Rmodule-import/C.h b/test/Modules/Inputs/Rmodule-import/C.h
new file mode 100644
index 0000000000..6f30d4750e
--- /dev/null
+++ b/test/Modules/Inputs/Rmodule-import/C.h
@@ -0,0 +1 @@
+// C
diff --git a/test/Modules/Inputs/Rmodule-import/D.h b/test/Modules/Inputs/Rmodule-import/D.h
new file mode 100644
index 0000000000..61177ec3a3
--- /dev/null
+++ b/test/Modules/Inputs/Rmodule-import/D.h
@@ -0,0 +1 @@
+// D
diff --git a/test/Modules/Inputs/Rmodule-import/module.modulemap b/test/Modules/Inputs/Rmodule-import/module.modulemap
new file mode 100644
index 0000000000..cf7cf1f7e5
--- /dev/null
+++ b/test/Modules/Inputs/Rmodule-import/module.modulemap
@@ -0,0 +1,4 @@
+module A { header "A.h" }
+module B { header "B.h" }
+module C { header "C.h" }
+module D { header "D.h" }
diff --git a/test/Modules/Inputs/implicit-invalidate-chain/A.h b/test/Modules/Inputs/implicit-invalidate-chain/A.h
new file mode 100644
index 0000000000..2b9dab8587
--- /dev/null
+++ b/test/Modules/Inputs/implicit-invalidate-chain/A.h
@@ -0,0 +1,2 @@
+// A
+#include "B.h"
diff --git a/test/Modules/Inputs/implicit-invalidate-chain/B.h b/test/Modules/Inputs/implicit-invalidate-chain/B.h
new file mode 100644
index 0000000000..a2711d4043
--- /dev/null
+++ b/test/Modules/Inputs/implicit-invalidate-chain/B.h
@@ -0,0 +1,2 @@
+// B
+#include "C.h"
diff --git a/test/Modules/Inputs/implicit-invalidate-chain/C.h b/test/Modules/Inputs/implicit-invalidate-chain/C.h
new file mode 100644
index 0000000000..231e35cf64
--- /dev/null
+++ b/test/Modules/Inputs/implicit-invalidate-chain/C.h
@@ -0,0 +1,2 @@
+// C
+#include "D.h"
diff --git a/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap b/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap
new file mode 100644
index 0000000000..f5b6360c1a
--- /dev/null
+++ b/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap
@@ -0,0 +1,3 @@
+module A { header "A.h" }
+module B { header "B.h" }
+module C { header "C.h" }
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/alias.h b/test/Modules/Inputs/nested-template-default-arg-redecl/alias.h
new file mode 100644
index 0000000000..cff3329ce1
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/alias.h
@@ -0,0 +1,7 @@
+#ifndef ALIAS_H
+#define ALIAS_H
+struct alias_outer {
+ template <typename = int>
+ using alias = int;
+};
+#endif
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/alias1.h b/test/Modules/Inputs/nested-template-default-arg-redecl/alias1.h
new file mode 100644
index 0000000000..736abcbbda
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/alias1.h
@@ -0,0 +1 @@
+#include "alias.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/alias2.h b/test/Modules/Inputs/nested-template-default-arg-redecl/alias2.h
new file mode 100644
index 0000000000..736abcbbda
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/alias2.h
@@ -0,0 +1 @@
+#include "alias.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/func.h b/test/Modules/Inputs/nested-template-default-arg-redecl/func.h
new file mode 100644
index 0000000000..7a15c697da
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/func.h
@@ -0,0 +1,7 @@
+#ifndef FUNC_H
+#define FUNC_H
+struct func_outer {
+ template <typename = int>
+ void func();
+};
+#endif
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/func1.h b/test/Modules/Inputs/nested-template-default-arg-redecl/func1.h
new file mode 100644
index 0000000000..940d76726b
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/func1.h
@@ -0,0 +1 @@
+#include "func.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/func2.h b/test/Modules/Inputs/nested-template-default-arg-redecl/func2.h
new file mode 100644
index 0000000000..940d76726b
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/func2.h
@@ -0,0 +1 @@
+#include "func.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/module.modulemap b/test/Modules/Inputs/nested-template-default-arg-redecl/module.modulemap
new file mode 100644
index 0000000000..a0071fd79e
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/module.modulemap
@@ -0,0 +1,24 @@
+module ALIAS1 {
+ header "alias1.h"
+ module ALIAS2 {
+ header "alias2.h"
+ }
+}
+module VAR1 {
+ header "var1.h"
+ module VAR2 {
+ header "var2.h"
+ }
+}
+module FUNC1 {
+ header "func1.h"
+ module FUNC2 {
+ header "func2.h"
+ }
+}
+module STRCT1 {
+ header "strct1.h"
+ module STRCT2 {
+ header "strct2.h"
+ }
+}
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/strct.h b/test/Modules/Inputs/nested-template-default-arg-redecl/strct.h
new file mode 100644
index 0000000000..04d12448f3
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/strct.h
@@ -0,0 +1,7 @@
+#ifndef STRCT_H
+#define STRCT_H
+struct strct_outer {
+ template <typename = int>
+ struct strct;
+};
+#endif
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/strct1.h b/test/Modules/Inputs/nested-template-default-arg-redecl/strct1.h
new file mode 100644
index 0000000000..5c29b94e1c
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/strct1.h
@@ -0,0 +1 @@
+#include "strct.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/strct2.h b/test/Modules/Inputs/nested-template-default-arg-redecl/strct2.h
new file mode 100644
index 0000000000..5c29b94e1c
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/strct2.h
@@ -0,0 +1 @@
+#include "strct.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/var.h b/test/Modules/Inputs/nested-template-default-arg-redecl/var.h
new file mode 100644
index 0000000000..3c3584dcb5
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/var.h
@@ -0,0 +1,9 @@
+#ifndef VAR_H
+#define VAR_H
+struct var_outer {
+ template <typename = int>
+ static int var;
+};
+#endif
+
+
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/var1.h b/test/Modules/Inputs/nested-template-default-arg-redecl/var1.h
new file mode 100644
index 0000000000..89cee816fb
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/var1.h
@@ -0,0 +1 @@
+#include "var.h"
diff --git a/test/Modules/Inputs/nested-template-default-arg-redecl/var2.h b/test/Modules/Inputs/nested-template-default-arg-redecl/var2.h
new file mode 100644
index 0000000000..89cee816fb
--- /dev/null
+++ b/test/Modules/Inputs/nested-template-default-arg-redecl/var2.h
@@ -0,0 +1 @@
+#include "var.h"
diff --git a/test/Modules/Inputs/relative-import-path/A.h b/test/Modules/Inputs/relative-import-path/A.h
new file mode 100644
index 0000000000..2b9dab8587
--- /dev/null
+++ b/test/Modules/Inputs/relative-import-path/A.h
@@ -0,0 +1,2 @@
+// A
+#include "B.h"
diff --git a/test/Modules/Inputs/relative-import-path/B.h b/test/Modules/Inputs/relative-import-path/B.h
new file mode 100644
index 0000000000..a2711d4043
--- /dev/null
+++ b/test/Modules/Inputs/relative-import-path/B.h
@@ -0,0 +1,2 @@
+// B
+#include "C.h"
diff --git a/test/Modules/Inputs/relative-import-path/C.h b/test/Modules/Inputs/relative-import-path/C.h
new file mode 100644
index 0000000000..6f30d4750e
--- /dev/null
+++ b/test/Modules/Inputs/relative-import-path/C.h
@@ -0,0 +1 @@
+// C
diff --git a/test/Modules/Inputs/relative-import-path/module.modulemap b/test/Modules/Inputs/relative-import-path/module.modulemap
new file mode 100644
index 0000000000..f5b6360c1a
--- /dev/null
+++ b/test/Modules/Inputs/relative-import-path/module.modulemap
@@ -0,0 +1,3 @@
+module A { header "A.h" }
+module B { header "B.h" }
+module C { header "C.h" }
diff --git a/test/Modules/ModuleDebugInfo.cpp b/test/Modules/ModuleDebugInfo.cpp
index 116aa5fc31..6fe546f701 100644
--- a/test/Modules/ModuleDebugInfo.cpp
+++ b/test/Modules/ModuleDebugInfo.cpp
@@ -119,8 +119,7 @@
// CHECK: ![[A:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "A",
// CHECK-SAME: elements:
-// CHECK-SAME: vtableHolder: ![[A]],
-// CHECK-SAME: identifier: "_ZTS1A")
+// CHECK-SAME: vtableHolder: ![[A]])
// CHECK: ![[DERIVED:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "Derived",
// CHECK-SAME: identifier: "_ZTS7Derived")
diff --git a/test/Modules/Rmodule-build.m b/test/Modules/Rmodule-build.m
index 5c27ec6dfd..e9e2ca964e 100644
--- a/test/Modules/Rmodule-build.m
+++ b/test/Modules/Rmodule-build.m
@@ -19,10 +19,6 @@
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \
// RUN: -Rmodule-build 2>&1 | FileCheck %s
-// RUN: echo ' ' >> %t/C.h
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \
-// RUN: -Reverything 2>&1 | FileCheck %s
-
// RUN: echo ' ' >> %t/B.h
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \
// RUN: 2>&1 | FileCheck -allow-empty -check-prefix=NO-REMARKS %s
diff --git a/test/Modules/Rmodule-import.m b/test/Modules/Rmodule-import.m
new file mode 100644
index 0000000000..11a1615007
--- /dev/null
+++ b/test/Modules/Rmodule-import.m
@@ -0,0 +1,46 @@
+// RUN: rm -rf %t1 %t2
+
+// Run with -verify, which onliy gets remarks from the main TU.
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
+// RUN: -fdisable-module-hash -fsyntax-only -I%S/Inputs/Rmodule-import \
+// RUN: -Rmodule-build -Rmodule-import -verify %s
+
+// Run again, using FileCheck to check remarks from the module builds.
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
+// RUN: -fdisable-module-hash -fsyntax-only -I%S/Inputs/Rmodule-import \
+// RUN: -Rmodule-build -Rmodule-import %s 2>&1 |\
+// RUN: FileCheck %s -implicit-check-not "remark:"
+
+#include "A.h" // \
+ expected-remark-re{{building module 'A' as '{{.*[/\\]}}A.pcm'}} \
+ expected-remark{{finished building module 'A'}} \
+ expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
+ expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
+ expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}}
+// CHECK: remark: building module 'A'
+// CHECK: remark: building module 'B'
+// CHECK: remark: building module 'C'
+// CHECK: remark: finished building module 'C'
+// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: finished building module 'B'
+// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: finished building module 'A'
+// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
+// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
+#include "B.h" // \
+ expected-remark-re{{importing module 'B' from '{{.*[/\\]}}B.pcm'}}
+// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
+#include "C.h" // \
+ expected-remark-re{{importing module 'C' from '{{.*[/\\]}}C.pcm'}}
+// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
+@import D; // \
+ expected-remark-re{{building module 'D' as '{{.*[/\\]}}D.pcm'}} \
+ expected-remark{{finished building module 'D'}} \
+ expected-remark-re{{importing module 'D' from '{{.*[/\\]}}D.pcm'}}
+// CHECK: remark: building module 'D'
+// CHECK: remark: finished building module 'D'
+// CHECK: remark: importing module 'D' from '{{.*[/\\]}}D.pcm'
diff --git a/test/Modules/framework-name.m b/test/Modules/framework-name.m
index a63e206073..5b5d4c6640 100644
--- a/test/Modules/framework-name.m
+++ b/test/Modules/framework-name.m
@@ -7,10 +7,10 @@
// Sanity check that we won't somehow find non-canonical module names or
// modules where we shouldn't search the framework.
-// RUN: echo '@import NameInModMap' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
-// RUN: echo '@import NameInDir' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
-// RUN: echo '@import NameInImport' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
-// RUN: echo '@import NameInImportInferred' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
+// RUN: echo '@import NameInModMap;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
+// RUN: echo '@import NameInDir;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
+// RUN: echo '@import NameInImport;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
+// RUN: echo '@import NameInImportInferred;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
// CHECK: module '{{.*}}' not found
// FIXME: We might want to someday lock down framework modules so that these
diff --git a/test/Modules/friend-definition-2.cpp b/test/Modules/friend-definition-2.cpp
index b226b5c0d1..41c2141f40 100644
--- a/test/Modules/friend-definition-2.cpp
+++ b/test/Modules/friend-definition-2.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fmodules %s -verify
-// RUN: %clang_cc1 -fmodules %s -verify -triple i686-windows
+// RUN: %clang_cc1 -std=c++14 -fmodules %s -verify
+// RUN: %clang_cc1 -std=c++14 -fmodules %s -verify -triple i686-windows
// expected-no-diagnostics
#pragma clang module build A
module A {}
diff --git a/test/Modules/implementation-of-module.m b/test/Modules/implementation-of-module.m
index 712f12c565..140d144410 100644
--- a/test/Modules/implementation-of-module.m
+++ b/test/Modules/implementation-of-module.m
@@ -1,17 +1,17 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -fsyntax-only
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -dM -E -o - 2>&1 | FileCheck %s
// CHECK-NOT: __building_module
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_left -verify
-// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \
+// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -emit-pch -o %t.pch
-// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \
+// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: -DWITH_PREFIX -fmodules-ignore-macro=WITH_PREFIX -include-pch %t.pch -fmodule-implementation-of category_right
#ifndef WITH_PREFIX
diff --git a/test/Modules/implicit-invalidate-chain.c b/test/Modules/implicit-invalidate-chain.c
new file mode 100644
index 0000000000..f7727a6579
--- /dev/null
+++ b/test/Modules/implicit-invalidate-chain.c
@@ -0,0 +1,67 @@
+// RUN: rm -rf %t1 %t2 %t-include
+// RUN: mkdir %t-include
+// RUN: echo 'module D { header "D.h" }' >> %t-include/module.modulemap
+
+// Run with -verify, which onliy gets remarks from the main TU.
+//
+// RUN: echo '#define D 0' > %t-include/D.h
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
+// RUN: -fdisable-module-hash -fsyntax-only \
+// RUN: -I%S/Inputs/implicit-invalidate-chain -I%t-include \
+// RUN: -Rmodule-build -Rmodule-import %s
+// RUN: echo '#define D 11' > %t-include/D.h
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
+// RUN: -fdisable-module-hash -fsyntax-only \
+// RUN: -I%S/Inputs/implicit-invalidate-chain -I%t-include \
+// RUN: -Rmodule-build -Rmodule-import -verify %s
+
+// Run again, using FileCheck to check remarks from the module builds. This is
+// the key test: after the first attempt to import an out-of-date 'D', all the
+// modules have been invalidated and are not imported again until they are
+// rebuilt.
+//
+// RUN: echo '#define D 0' > %t-include/D.h
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
+// RUN: -fdisable-module-hash -fsyntax-only \
+// RUN: -I%S/Inputs/implicit-invalidate-chain -I%t-include \
+// RUN: -Rmodule-build -Rmodule-import %s
+// RUN: echo '#define D 11' > %t-include/D.h
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
+// RUN: -fdisable-module-hash -fsyntax-only \
+// RUN: -I%S/Inputs/implicit-invalidate-chain -I%t-include \
+// RUN: -Rmodule-build -Rmodule-import %s 2>&1 |\
+// RUN: FileCheck %s -implicit-check-not "remark:"
+
+#include "A.h" // \
+ expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
+ expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
+ expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}} \
+ expected-remark-re{{importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'}} \
+ expected-remark-re{{building module 'A' as '{{.*[/\\]}}A.pcm'}} \
+ expected-remark{{finished building module 'A'}} \
+ expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
+ expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
+ expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}} \
+ expected-remark-re{{importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'}}
+// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
+// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
+// CHECK: remark: building module 'A'
+// CHECK: remark: building module 'B'
+// CHECK: remark: building module 'C'
+// CHECK: remark: building module 'D'
+// CHECK: remark: finished building module 'D'
+// CHECK: remark: importing module 'D' from '{{.*[/\\]}}D.pcm'
+// CHECK: remark: finished building module 'C'
+// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
+// CHECK: remark: finished building module 'B'
+// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
+// CHECK: remark: finished building module 'A'
+// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
+// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
+// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
diff --git a/test/Modules/initializers.cpp b/test/Modules/initializers.cpp
new file mode 100644
index 0000000000..68eb952c2e
--- /dev/null
+++ b/test/Modules/initializers.cpp
@@ -0,0 +1,241 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -DIMPORT=1 -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-IMPORT,CHECK-NO-NS,CHECK-IMPORT-NO-NS --implicit-check-not=unused
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -DIMPORT=1 -DNS -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-IMPORT,CHECK-NS,CHECK-IMPORT-NS --implicit-check-not=unused
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -DIMPORT=2 -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NO-NS --implicit-check-not=unused
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -DIMPORT=2 -DNS -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NS --implicit-check-not=unused
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NO-NS --implicit-check-not=unused
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -emit-llvm -DNS -fmodules %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NS --implicit-check-not=unused
+
+// Check that we behave sensibly when importing a header containing strong and
+// weak, ordered and unordered global initializers.
+//
+// Our behavior is as follows:
+//
+// -- for variables with one or more specific points of initialization
+// (non-template variables, whether or not they are inline or thread_local),
+// emit them if (and only if) a header containing a point of initialization
+// is transitively #included / imported.
+//
+// -- for variables with unordered initialization (any kind of templated
+// variable -- excluding explicit specializations), emit them if any part
+// of any module that triggers an instantiation is imported.
+//
+// The intent is to:
+//
+// 1) preserve order of initialization guarantees
+// 2) preserve the behavior of globals with ctors in headers, and specifically
+// of std::ios_base::Init (do not run the iostreams initializer nor force
+// linking in the iostreams portion of the static library unless <iostream>
+// is included)
+// 3) behave conservatively-correctly with regard to unordered initializers: we
+// might run them in cases where a traditional compilation would not, but
+// will never fail to run them in cases where a traditional compilation
+// would do so
+//
+// Perfect handling of unordered initializers would require tracking all
+// submodules containing points of instantiation, which is very hard when those
+// points of instantiation are within definitions that we skip because we
+// already have a (non-visible) definition for the entity:
+//
+// // a.h
+// template<typename> int v = f();
+// inline int get() { return v<int>; }
+//
+// // b.h
+// template<typename> int v = f();
+// inline int get() { return v<int>; }
+//
+// If a.h and b.h are built as a module, we will only have a point of
+// instantiation for v<int> in one of the two headers, because we will only
+// parse one of the two get() functions.
+
+#pragma clang module build m
+module m {
+ module a {
+ header "foo.h" { size 123 mtime 456789 }
+ }
+ module b {}
+}
+
+#pragma clang module contents
+#pragma clang module begin m.a
+inline int non_trivial() { return 3; }
+
+#ifdef NS
+namespace ns {
+#endif
+
+int a = non_trivial();
+inline int b = non_trivial();
+thread_local int c = non_trivial();
+inline thread_local int d = non_trivial();
+
+template<typename U> int e = non_trivial();
+template<typename U> inline int f = non_trivial();
+template<typename U> thread_local int g = non_trivial();
+template<typename U> inline thread_local int h = non_trivial();
+
+inline int unused = 123; // should not be emitted
+
+template<typename T> struct X {
+ static int a;
+ static inline int b = non_trivial();
+ static thread_local int c;
+ static inline thread_local int d = non_trivial();
+
+ template<typename U> static int e;
+ template<typename U> static inline int f = non_trivial();
+ template<typename U> static thread_local int g;
+ template<typename U> static inline thread_local int h = non_trivial();
+
+ static inline int unused = 123; // should not be emitted
+};
+
+template<typename T> int X<T>::a = non_trivial();
+template<typename T> thread_local int X<T>::c = non_trivial();
+template<typename T> template<typename U> int X<T>::e = non_trivial();
+template<typename T> template<typename U> thread_local int X<T>::g = non_trivial();
+
+inline void use(bool b, ...) {
+ if (b) return;
+ use(true, e<int>, f<int>, g<int>, h<int>,
+ X<int>::a, X<int>::b, X<int>::c, X<int>::d,
+ X<int>::e<int>, X<int>::f<int>, X<int>::g<int>, X<int>::h<int>);
+}
+
+#ifdef NS
+}
+#endif
+
+#pragma clang module end
+#pragma clang module endbuild
+
+#if IMPORT == 1
+// Import the module and the m.a submodule; runs the ordered initializers and
+// the unordered initializers.
+#pragma clang module import m.a
+#elif IMPORT == 2
+// Import the module but not the m.a submodule; runs only the unordered
+// initializers.
+#pragma clang module import m.b
+#else
+// Load the module but do not import any submodules; runs only the unordered
+// initializers. FIXME: Should this skip all of them?
+#pragma clang module load m
+#endif
+
+// CHECK-IMPORT-NO-NS-DAG: @[[A:a]] = global i32 0, align 4
+// CHECK-IMPORT-NO-NS-DAG: @[[B:b]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-IMPORT-NO-NS-DAG: @[[C:c]] = thread_local global i32 0, align 4
+// CHECK-IMPORT-NO-NS-DAG: @[[D:d]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-NO-NS-DAG: @[[E:_Z1eIiE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-NO-NS-DAG: @[[F:_Z1fIiE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-NO-NS-DAG: @[[G:_Z1gIiE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-NO-NS-DAG: @[[H:_Z1hIiE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+
+// CHECK-IMPORT-NS-DAG: @[[A:_ZN2ns1aE]] = global i32 0, align 4
+// CHECK-IMPORT-NS-DAG: @[[B:_ZN2ns1bE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-IMPORT-NS-DAG: @[[BG:_ZGVN2ns1bE]] = linkonce_odr global i64 0, comdat($[[B]]), align 8
+// CHECK-IMPORT-NS-DAG: @[[C:_ZN2ns1cE]] = thread_local global i32 0, align 4
+// CHECK-IMPORT-NS-DAG: @[[D:_ZN2ns1dE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-IMPORT-NS-DAG: @[[DG:_ZGVN2ns1dE]] = linkonce_odr thread_local global i64 0, comdat($[[D]]), align 8
+// CHECK-NS-DAG: @[[E:_ZN2ns1eIiEE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-NS-DAG: @[[F:_ZN2ns1fIiEE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-NS-DAG: @[[G:_ZN2ns1gIiEE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-NS-DAG: @[[H:_ZN2ns1hIiEE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+
+// CHECK-DAG: @[[XA:_ZN(2ns)?1XIiE1aE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-DAG: @[[XB:_ZN(2ns)?1XIiE1bE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-DAG: @[[XC:_ZN(2ns)?1XIiE1cE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-DAG: @[[XD:_ZN(2ns)?1XIiE1dE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-DAG: @[[XE:_ZN(2ns)?1XIiE1eIiEE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-DAG: @[[XF:_ZN(2ns)?1XIiE1fIiEE]] = linkonce_odr global i32 0, comdat, align 4
+// CHECK-DAG: @[[XG:_ZN(2ns)?1XIiE1gIiEE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+// CHECK-DAG: @[[XH:_ZN(2ns)?1XIiE1hIiEE]] = linkonce_odr thread_local global i32 0, comdat, align 4
+
+// It's OK if the order of the first 6 of these changes.
+// CHECK: @llvm.global_ctors = appending global
+// CHECK-SAME: @[[E_INIT:[^,]*]], {{[^@]*}} @[[E]]
+// CHECK-SAME: @[[F_INIT:[^,]*]], {{[^@]*}} @[[F]]
+// CHECK-SAME: @[[XA_INIT:[^,]*]], {{[^@]*}} @[[XA]]
+// CHECK-SAME: @[[XE_INIT:[^,]*]], {{[^@]*}} @[[XE]]
+// CHECK-SAME: @[[XF_INIT:[^,]*]], {{[^@]*}} @[[XF]]
+// CHECK-SAME: @[[XB_INIT:[^,]*]], {{[^@]*}} @[[XB]]
+// CHECK-IMPORT-SAME: @[[TU_INIT:[^,]*]], i8* null }]
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[E_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[E]],
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[F_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[F]],
+
+// CHECK: define {{.*}} @[[G_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[G]],
+
+// CHECK: define {{.*}} @[[H_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[H]],
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[XA_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XA]],
+
+// CHECK: define {{.*}} @[[XC_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XC]],
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[XE_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XE]],
+
+// CHECK: define {{.*}} @[[XG_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XG]],
+
+// CHECK: define {{.*}} @[[XH_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XH]],
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[XF_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XF]],
+
+// CHECK: define {{.*}} @[[XD_INIT:__cxx_global.*]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XD]],
+
+// FIXME: Should this use __cxa_guard_acquire?
+// CHECK: define {{.*}} @[[XB_INIT]]()
+// CHECK: load {{.*}} (i64* @_ZGV
+// CHECK: store {{.*}}, i32* @[[XB]],
+
+// CHECK-IMPORT: define {{.*}} @[[A_INIT:__cxx_global.*]]()
+// CHECK-IMPORT: call i32 @_Z11non_trivialv(
+// CHECK-IMPORT: store {{.*}}, i32* @[[A]],
+
+// CHECK-IMPORT: define {{.*}} @[[B_INIT:__cxx_global.*]]()
+// CHECK-IMPORT: call i32 @__cxa_guard_acquire(i64* @_ZGV
+// CHECK-IMPORT: store {{.*}}, i32* @[[B]],
+
+// CHECK-IMPORT: define {{.*}} @[[C_INIT:__cxx_global.*]]()
+// CHECK-IMPORT: call i32 @_Z11non_trivialv(
+// CHECK-IMPORT: store {{.*}}, i32* @[[C]],
+
+// CHECK-IMPORT: define {{.*}} @[[D_INIT:__cxx_global.*]]()
+// CHECK-IMPORT: load {{.*}} (i64* @_ZGV
+// CHECK-IMPORT: store {{.*}}, i32* @[[D]],
+
+
+// CHECK-IMPORT: define {{.*}} @[[TU_INIT]]()
+// CHECK-IMPORT: call void @[[A_INIT]]()
+
+// CHECK-IMPORT: define {{.*}} @__tls_init()
+// CHECK-IMPORT: call void @[[C_INIT]]()
+// CHECK-IMPORT: call void @[[D_INIT]]()
diff --git a/test/Modules/merge-lambdas.cpp b/test/Modules/merge-lambdas.cpp
index 463a4c9b2f..da10ec1199 100644
--- a/test/Modules/merge-lambdas.cpp
+++ b/test/Modules/merge-lambdas.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fmodules -verify %s -emit-llvm-only
+// RUN: %clang_cc1 -std=c++14 -fmodules -verify %s -emit-llvm-only
// expected-no-diagnostics
#pragma clang module build A
diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m
index 0e31389350..677eff8e8e 100644
--- a/test/Modules/module_file_info.m
+++ b/test/Modules/module_file_info.m
@@ -21,7 +21,7 @@
// CHECK: Language options:
// CHECK: C99: Yes
// CHECK: Objective-C: Yes
-// CHECK: modules extension to C: Yes
+// CHECK: modules semantics: Yes
// CHECK: Module features:
// CHECK: myfeature
diff --git a/test/Modules/nested-template-default-arg-redecl.cpp b/test/Modules/nested-template-default-arg-redecl.cpp
new file mode 100644
index 0000000000..55568f8711
--- /dev/null
+++ b/test/Modules/nested-template-default-arg-redecl.cpp
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
+// RUN: -I %S/Inputs/nested-template-default-arg-redecl -std=c++14 \
+// RUN: -fmodules-local-submodule-visibility -w -verify %s
+
+// expected-no-diagnostics
+
+#include "alias2.h"
+#include "var2.h"
+#include "strct2.h"
+#include "func2.h"
+
+auto var = &var_outer::var<>;
+auto func = &func_outer::func<>;
+strct_outer::strct<> *strct;
+alias_outer::alias<> *alias;
diff --git a/test/Modules/odr_hash.cpp b/test/Modules/odr_hash.cpp
index e4c5ba6f82..f22a8b8f8a 100644
--- a/test/Modules/odr_hash.cpp
+++ b/test/Modules/odr_hash.cpp
@@ -4587,6 +4587,43 @@ int num = bar();
#endif
}
+namespace FunctionProtoTypeDecay {
+#if defined(FIRST)
+struct S1 {
+ struct X {};
+ using Y = X(X());
+};
+#elif defined(SECOND)
+struct S1 {
+ struct X {};
+ using Y = X(X(X()));
+};
+#else
+S1 s1;
+// expected-error@first.h:* {{'FunctionProtoTypeDecay::S1::Y' from module 'FirstModule' is not present in definition of 'FunctionProtoTypeDecay::S1' in module 'SecondModule'}}
+// expected-note@second.h:* {{declaration of 'Y' does not match}}
+#endif
+
+#if defined(FIRST)
+struct S2 {
+ struct X {};
+ using Y =
+ X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(
+ X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(
+ X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(
+ X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(
+ ))))))))))))))))
+ ))))))))))))))))
+ ))))))))))))))))
+ ))))))))))))))));
+};
+#elif defined(SECOND)
+#else
+S2 s2;
+#endif
+
+}
+
// Keep macros contained to one file.
#ifdef FIRST
#undef FIRST
diff --git a/test/Modules/outofdate-rebuild.m b/test/Modules/outofdate-rebuild.m
index 510325f62d..b18c94c54b 100644
--- a/test/Modules/outofdate-rebuild.m
+++ b/test/Modules/outofdate-rebuild.m
@@ -11,5 +11,5 @@
// RUN: -fsyntax-only
// This testcase reproduces a use-after-free in when ModuleManager removes an
-// entry from the PCMCache without notifying its parent ASTReader.
+// entry from the ModuleCache without notifying its parent ASTReader.
@import Cocoa;
diff --git a/test/Modules/pch_container.m b/test/Modules/pch_container.m
index 95ef3edcd6..541c4b7e27 100644
--- a/test/Modules/pch_container.m
+++ b/test/Modules/pch_container.m
@@ -7,7 +7,7 @@
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fmodules -fmodule-format=raw -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-raw -F %S/Inputs %s
-// RUN: llvm-objdump -section-headers %t-MachO/DependsOnModule.pcm %t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s
+// RUN: llvm-objdump --section-headers %t-MachO/DependsOnModule.pcm %t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s
// CHECK: file format Mach-O 64-bit x86-64
// CHECK: __clangast {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
// CHECK: file format ELF64-x86-64
@@ -15,6 +15,6 @@
// CHECK: file format COFF-x86-64
// CHECK: clangast {{[0-9a-f]+}} {{[0-9a-f]+}}
-// RUN: not llvm-objdump -section-headers %t-raw/DependsOnModule.pcm
+// RUN: not llvm-objdump --section-headers %t-raw/DependsOnModule.pcm
// RUN: %clang_cc1 -split-dwarf-file t-split.dwo -triple=x86_64-linux-elf -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-ELF_SPLIT -F %S/Inputs %s -o %t-split.o
diff --git a/test/Modules/relative-import-path.c b/test/Modules/relative-import-path.c
new file mode 100644
index 0000000000..045ab2bd3c
--- /dev/null
+++ b/test/Modules/relative-import-path.c
@@ -0,0 +1,26 @@
+// RUN: rm -rf %t
+// RUN: cp -r %S/Inputs/relative-import-path %t
+// RUN: cp %s %t/t.c
+
+// Use FileCheck, which is more flexible.
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
+// RUN: -fdisable-module-hash -fsyntax-only \
+// RUN: -I%S/Inputs/relative-import-path \
+// RUN: -working-directory=%t \
+// RUN: -Rmodule-build -Rmodule-import t.c 2>&1 |\
+// RUN: FileCheck %s -implicit-check-not "remark:" -DWORKDIR=%t
+
+#include "A.h" // \
+// CHECK: remark: building module 'A'
+// CHECK: remark: building module 'B'
+// CHECK: remark: building module 'C'
+// CHECK: remark: finished building module 'C'
+// CHECK: remark: importing module 'C' from '[[WORKDIR]]{{[/\\]cache[/\\]}}C.pcm'
+// CHECK: remark: finished building module 'B'
+// CHECK: remark: importing module 'B' from '[[WORKDIR]]{{[/\\]cache[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '[[WORKDIR]]{{[/\\]cache[/\\]}}C.pcm'
+// CHECK: remark: finished building module 'A'
+// CHECK: remark: importing module 'A' from '[[WORKDIR]]{{[/\\]cache[/\\]}}A.pcm'
+// CHECK: remark: importing module 'B' into 'A' from '[[WORKDIR]]{{[/\\]cache[/\\]}}B.pcm'
+// CHECK: remark: importing module 'C' into 'B' from '[[WORKDIR]]{{[/\\]cache[/\\]}}C.pcm'
diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm
index 6639775986..78206a980a 100644
--- a/test/Modules/templates.mm
+++ b/test/Modules/templates.mm
@@ -108,11 +108,11 @@ void testStaticDataMember() {
WithUndefinedStaticDataMember<int[]> load_it;
// CHECK-LABEL: define linkonce_odr i32* @_Z23getStaticDataMemberLeftv(
- // CHECK: ret i32* getelementptr inbounds ([0 x i32], [0 x i32]* @_ZN29WithUndefinedStaticDataMemberIA_iE9undefinedE, i32 0, i32 0)
+ // CHECK: ret i32* getelementptr inbounds ([0 x i32], [0 x i32]* @_ZN29WithUndefinedStaticDataMemberIA_iE9undefinedE, i64 0, i64 0)
(void) getStaticDataMemberLeft();
// CHECK-LABEL: define linkonce_odr i32* @_Z24getStaticDataMemberRightv(
- // CHECK: ret i32* getelementptr inbounds ([0 x i32], [0 x i32]* @_ZN29WithUndefinedStaticDataMemberIA_iE9undefinedE, i32 0, i32 0)
+ // CHECK: ret i32* getelementptr inbounds ([0 x i32], [0 x i32]* @_ZN29WithUndefinedStaticDataMemberIA_iE9undefinedE, i64 0, i64 0)
(void) getStaticDataMemberRight();
}