summaryrefslogtreecommitdiff
path: root/test/ASTMerge
diff options
context:
space:
mode:
Diffstat (limited to 'test/ASTMerge')
-rw-r--r--test/ASTMerge/anonymous-fields/Inputs/anonymous-fields1.cpp (renamed from test/ASTMerge/Inputs/anonymous-fields1.cpp)0
-rw-r--r--test/ASTMerge/anonymous-fields/Inputs/anonymous-fields2.cpp (renamed from test/ASTMerge/Inputs/anonymous-fields2.cpp)0
-rw-r--r--test/ASTMerge/anonymous-fields/test.cpp (renamed from test/ASTMerge/anonymous-fields.cpp)0
-rw-r--r--test/ASTMerge/asm/Inputs/asm-function.cpp11
-rw-r--r--test/ASTMerge/asm/test.cpp7
-rw-r--r--test/ASTMerge/category/Inputs/category1.m (renamed from test/ASTMerge/Inputs/category1.m)0
-rw-r--r--test/ASTMerge/category/Inputs/category2.m (renamed from test/ASTMerge/Inputs/category2.m)0
-rw-r--r--test/ASTMerge/category/test.m (renamed from test/ASTMerge/category.m)0
-rw-r--r--test/ASTMerge/class-template/Inputs/class-template1.cpp (renamed from test/ASTMerge/Inputs/class-template1.cpp)0
-rw-r--r--test/ASTMerge/class-template/Inputs/class-template2.cpp (renamed from test/ASTMerge/Inputs/class-template2.cpp)0
-rw-r--r--test/ASTMerge/class-template/test.cpp (renamed from test/ASTMerge/class-template.cpp)0
-rw-r--r--test/ASTMerge/class/Inputs/class1.cpp (renamed from test/ASTMerge/Inputs/class1.cpp)0
-rw-r--r--test/ASTMerge/class/Inputs/class2.cpp (renamed from test/ASTMerge/Inputs/class2.cpp)0
-rw-r--r--test/ASTMerge/class/test.cpp (renamed from test/ASTMerge/class.cpp)0
-rw-r--r--test/ASTMerge/class2/Inputs/class3.cpp26
-rw-r--r--test/ASTMerge/class2/test.cpp9
-rw-r--r--test/ASTMerge/codegen-body/Inputs/body1.c (renamed from test/ASTMerge/Inputs/body1.c)0
-rw-r--r--test/ASTMerge/codegen-body/Inputs/body2.c (renamed from test/ASTMerge/Inputs/body2.c)0
-rw-r--r--test/ASTMerge/codegen-body/test.c (renamed from test/ASTMerge/codegen-body.c)0
-rw-r--r--test/ASTMerge/codegen-exprs/Inputs/exprs1.c (renamed from test/ASTMerge/Inputs/exprs1.c)0
-rw-r--r--test/ASTMerge/codegen-exprs/Inputs/exprs2.c (renamed from test/ASTMerge/Inputs/exprs2.c)0
-rw-r--r--test/ASTMerge/codegen-exprs/test.c (renamed from test/ASTMerge/codegen-exprs.c)0
-rw-r--r--test/ASTMerge/enum/Inputs/enum1.c (renamed from test/ASTMerge/Inputs/enum1.c)0
-rw-r--r--test/ASTMerge/enum/Inputs/enum2.c (renamed from test/ASTMerge/Inputs/enum2.c)0
-rw-r--r--test/ASTMerge/enum/test.c (renamed from test/ASTMerge/enum.c)0
-rw-r--r--test/ASTMerge/exprs-cpp/Inputs/exprs3.cpp120
-rw-r--r--test/ASTMerge/exprs-cpp/test.cpp45
-rw-r--r--test/ASTMerge/exprs/Inputs/exprs1.c10
-rw-r--r--test/ASTMerge/exprs/Inputs/exprs2.c10
-rw-r--r--test/ASTMerge/exprs/test.c (renamed from test/ASTMerge/exprs.c)0
-rw-r--r--test/ASTMerge/function/Inputs/function1.c (renamed from test/ASTMerge/Inputs/function1.c)0
-rw-r--r--test/ASTMerge/function/Inputs/function2.c (renamed from test/ASTMerge/Inputs/function2.c)0
-rw-r--r--test/ASTMerge/function/test.c (renamed from test/ASTMerge/function.c)0
-rw-r--r--test/ASTMerge/inheritance/Inputs/inheritance-base.cpp (renamed from test/ASTMerge/Inputs/inheritance-base.cpp)0
-rw-r--r--test/ASTMerge/inheritance/test.cpp (renamed from test/ASTMerge/inheritance.cpp)0
-rw-r--r--test/ASTMerge/init-ctors/Inputs/init-ctors-classes.cpp (renamed from test/ASTMerge/Inputs/init-ctors-classes.cpp)0
-rw-r--r--test/ASTMerge/init-ctors/test.cpp (renamed from test/ASTMerge/init-ctors.cpp)0
-rw-r--r--test/ASTMerge/interface/Inputs/interface1.m (renamed from test/ASTMerge/Inputs/interface1.m)0
-rw-r--r--test/ASTMerge/interface/Inputs/interface2.m (renamed from test/ASTMerge/Inputs/interface2.m)0
-rw-r--r--test/ASTMerge/interface/test.m (renamed from test/ASTMerge/interface.m)0
-rw-r--r--test/ASTMerge/macro/Inputs/macro.modulemap4
-rw-r--r--test/ASTMerge/macro/Inputs/macro1.h5
-rw-r--r--test/ASTMerge/macro/Inputs/macro1.m5
-rw-r--r--test/ASTMerge/macro/Inputs/macro2.m5
-rw-r--r--test/ASTMerge/macro/test.m6
-rw-r--r--test/ASTMerge/namespace/Inputs/namespace1.cpp (renamed from test/ASTMerge/Inputs/namespace1.cpp)0
-rw-r--r--test/ASTMerge/namespace/Inputs/namespace2.cpp (renamed from test/ASTMerge/Inputs/namespace2.cpp)0
-rw-r--r--test/ASTMerge/namespace/test.cpp (renamed from test/ASTMerge/namespace.cpp)0
-rw-r--r--test/ASTMerge/property/Inputs/property1.m (renamed from test/ASTMerge/Inputs/property1.m)0
-rw-r--r--test/ASTMerge/property/Inputs/property2.m (renamed from test/ASTMerge/Inputs/property2.m)0
-rw-r--r--test/ASTMerge/property/test.m (renamed from test/ASTMerge/property.m)0
-rw-r--r--test/ASTMerge/struct/Inputs/struct1.c (renamed from test/ASTMerge/Inputs/struct1.c)0
-rw-r--r--test/ASTMerge/struct/Inputs/struct2.c (renamed from test/ASTMerge/Inputs/struct2.c)0
-rw-r--r--test/ASTMerge/struct/test.c (renamed from test/ASTMerge/struct.c)0
-rw-r--r--test/ASTMerge/typedef/Inputs/typedef1.c (renamed from test/ASTMerge/Inputs/typedef1.c)0
-rw-r--r--test/ASTMerge/typedef/Inputs/typedef2.c (renamed from test/ASTMerge/Inputs/typedef2.c)0
-rw-r--r--test/ASTMerge/typedef/test.c (renamed from test/ASTMerge/typedef.c)0
-rw-r--r--test/ASTMerge/var/Inputs/var1.c (renamed from test/ASTMerge/Inputs/var1.c)0
-rw-r--r--test/ASTMerge/var/Inputs/var1.h (renamed from test/ASTMerge/Inputs/var1.h)0
-rw-r--r--test/ASTMerge/var/Inputs/var2.c (renamed from test/ASTMerge/Inputs/var2.c)0
-rw-r--r--test/ASTMerge/var/test.c (renamed from test/ASTMerge/var.c)0
61 files changed, 263 insertions, 0 deletions
diff --git a/test/ASTMerge/Inputs/anonymous-fields1.cpp b/test/ASTMerge/anonymous-fields/Inputs/anonymous-fields1.cpp
index 829bc0edd30a6..829bc0edd30a6 100644
--- a/test/ASTMerge/Inputs/anonymous-fields1.cpp
+++ b/test/ASTMerge/anonymous-fields/Inputs/anonymous-fields1.cpp
diff --git a/test/ASTMerge/Inputs/anonymous-fields2.cpp b/test/ASTMerge/anonymous-fields/Inputs/anonymous-fields2.cpp
index 28ea46d98711b..28ea46d98711b 100644
--- a/test/ASTMerge/Inputs/anonymous-fields2.cpp
+++ b/test/ASTMerge/anonymous-fields/Inputs/anonymous-fields2.cpp
diff --git a/test/ASTMerge/anonymous-fields.cpp b/test/ASTMerge/anonymous-fields/test.cpp
index 67afc29d07e5b..67afc29d07e5b 100644
--- a/test/ASTMerge/anonymous-fields.cpp
+++ b/test/ASTMerge/anonymous-fields/test.cpp
diff --git a/test/ASTMerge/asm/Inputs/asm-function.cpp b/test/ASTMerge/asm/Inputs/asm-function.cpp
new file mode 100644
index 0000000000000..59c4edfbcd251
--- /dev/null
+++ b/test/ASTMerge/asm/Inputs/asm-function.cpp
@@ -0,0 +1,11 @@
+
+unsigned char asmFunc(unsigned char a, unsigned char b) {
+ unsigned int la = a;
+ unsigned int lb = b;
+ unsigned int bigres;
+ unsigned char res;
+ __asm__ ("0:\n1:\n" : [bigres] "=la"(bigres) : [la] "0"(la), [lb] "c"(lb) :
+ "edx", "cc");
+ res = bigres;
+ return res;
+}
diff --git a/test/ASTMerge/asm/test.cpp b/test/ASTMerge/asm/test.cpp
new file mode 100644
index 0000000000000..3a0a205720fe1
--- /dev/null
+++ b/test/ASTMerge/asm/test.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -emit-pch -o %t.1.ast %S/Inputs/asm-function.cpp
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -ast-merge %t.1.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+void testAsmImport() {
+ asmFunc(12, 42);
+}
diff --git a/test/ASTMerge/Inputs/category1.m b/test/ASTMerge/category/Inputs/category1.m
index afcaab81f2b7b..afcaab81f2b7b 100644
--- a/test/ASTMerge/Inputs/category1.m
+++ b/test/ASTMerge/category/Inputs/category1.m
diff --git a/test/ASTMerge/Inputs/category2.m b/test/ASTMerge/category/Inputs/category2.m
index 49a3c270a1c24..49a3c270a1c24 100644
--- a/test/ASTMerge/Inputs/category2.m
+++ b/test/ASTMerge/category/Inputs/category2.m
diff --git a/test/ASTMerge/category.m b/test/ASTMerge/category/test.m
index c7d524816494a..c7d524816494a 100644
--- a/test/ASTMerge/category.m
+++ b/test/ASTMerge/category/test.m
diff --git a/test/ASTMerge/Inputs/class-template1.cpp b/test/ASTMerge/class-template/Inputs/class-template1.cpp
index 440b5abfc869b..440b5abfc869b 100644
--- a/test/ASTMerge/Inputs/class-template1.cpp
+++ b/test/ASTMerge/class-template/Inputs/class-template1.cpp
diff --git a/test/ASTMerge/Inputs/class-template2.cpp b/test/ASTMerge/class-template/Inputs/class-template2.cpp
index 6300301a4ffac..6300301a4ffac 100644
--- a/test/ASTMerge/Inputs/class-template2.cpp
+++ b/test/ASTMerge/class-template/Inputs/class-template2.cpp
diff --git a/test/ASTMerge/class-template.cpp b/test/ASTMerge/class-template/test.cpp
index 0ab5443db7f6f..0ab5443db7f6f 100644
--- a/test/ASTMerge/class-template.cpp
+++ b/test/ASTMerge/class-template/test.cpp
diff --git a/test/ASTMerge/Inputs/class1.cpp b/test/ASTMerge/class/Inputs/class1.cpp
index b0a7645cfe630..b0a7645cfe630 100644
--- a/test/ASTMerge/Inputs/class1.cpp
+++ b/test/ASTMerge/class/Inputs/class1.cpp
diff --git a/test/ASTMerge/Inputs/class2.cpp b/test/ASTMerge/class/Inputs/class2.cpp
index 2bed6d775bc46..2bed6d775bc46 100644
--- a/test/ASTMerge/Inputs/class2.cpp
+++ b/test/ASTMerge/class/Inputs/class2.cpp
diff --git a/test/ASTMerge/class.cpp b/test/ASTMerge/class/test.cpp
index a68a2d1d7690f..a68a2d1d7690f 100644
--- a/test/ASTMerge/class.cpp
+++ b/test/ASTMerge/class/test.cpp
diff --git a/test/ASTMerge/class2/Inputs/class3.cpp b/test/ASTMerge/class2/Inputs/class3.cpp
new file mode 100644
index 0000000000000..428acc3f03199
--- /dev/null
+++ b/test/ASTMerge/class2/Inputs/class3.cpp
@@ -0,0 +1,26 @@
+class C1 {
+public:
+ C1();
+ ~C1();
+ C1 *method_1() {
+ return this;
+ }
+ C1 method_2() {
+ return C1();
+ }
+ void method_3() {
+ const C1 &ref = C1();
+ }
+};
+
+class C11 : public C1 {
+};
+
+class C2 {
+private:
+ int x;
+ friend class C3;
+public:
+ static_assert(sizeof(x) == sizeof(int), "Error");
+ typedef class C2::C2 InjType;
+};
diff --git a/test/ASTMerge/class2/test.cpp b/test/ASTMerge/class2/test.cpp
new file mode 100644
index 0000000000000..6021403d72291
--- /dev/null
+++ b/test/ASTMerge/class2/test.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -emit-pch -o %t.1.ast %S/Inputs/class3.cpp
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -ast-merge %t.1.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class C3 {
+ int method_1(C2 *x) {
+ return x->x;
+ }
+};
diff --git a/test/ASTMerge/Inputs/body1.c b/test/ASTMerge/codegen-body/Inputs/body1.c
index d4d1e4b93781f..d4d1e4b93781f 100644
--- a/test/ASTMerge/Inputs/body1.c
+++ b/test/ASTMerge/codegen-body/Inputs/body1.c
diff --git a/test/ASTMerge/Inputs/body2.c b/test/ASTMerge/codegen-body/Inputs/body2.c
index 73cb1edf99175..73cb1edf99175 100644
--- a/test/ASTMerge/Inputs/body2.c
+++ b/test/ASTMerge/codegen-body/Inputs/body2.c
diff --git a/test/ASTMerge/codegen-body.c b/test/ASTMerge/codegen-body/test.c
index 7232bf4164b58..7232bf4164b58 100644
--- a/test/ASTMerge/codegen-body.c
+++ b/test/ASTMerge/codegen-body/test.c
diff --git a/test/ASTMerge/Inputs/exprs1.c b/test/ASTMerge/codegen-exprs/Inputs/exprs1.c
index 1c268da15f3d3..1c268da15f3d3 100644
--- a/test/ASTMerge/Inputs/exprs1.c
+++ b/test/ASTMerge/codegen-exprs/Inputs/exprs1.c
diff --git a/test/ASTMerge/Inputs/exprs2.c b/test/ASTMerge/codegen-exprs/Inputs/exprs2.c
index 1c268da15f3d3..1c268da15f3d3 100644
--- a/test/ASTMerge/Inputs/exprs2.c
+++ b/test/ASTMerge/codegen-exprs/Inputs/exprs2.c
diff --git a/test/ASTMerge/codegen-exprs.c b/test/ASTMerge/codegen-exprs/test.c
index b5069f993be54..b5069f993be54 100644
--- a/test/ASTMerge/codegen-exprs.c
+++ b/test/ASTMerge/codegen-exprs/test.c
diff --git a/test/ASTMerge/Inputs/enum1.c b/test/ASTMerge/enum/Inputs/enum1.c
index f2b9c5c98fdec..f2b9c5c98fdec 100644
--- a/test/ASTMerge/Inputs/enum1.c
+++ b/test/ASTMerge/enum/Inputs/enum1.c
diff --git a/test/ASTMerge/Inputs/enum2.c b/test/ASTMerge/enum/Inputs/enum2.c
index 315b4dcb6ef51..315b4dcb6ef51 100644
--- a/test/ASTMerge/Inputs/enum2.c
+++ b/test/ASTMerge/enum/Inputs/enum2.c
diff --git a/test/ASTMerge/enum.c b/test/ASTMerge/enum/test.c
index 7240bcced99eb..7240bcced99eb 100644
--- a/test/ASTMerge/enum.c
+++ b/test/ASTMerge/enum/test.c
diff --git a/test/ASTMerge/exprs-cpp/Inputs/exprs3.cpp b/test/ASTMerge/exprs-cpp/Inputs/exprs3.cpp
new file mode 100644
index 0000000000000..7ed8e338452f7
--- /dev/null
+++ b/test/ASTMerge/exprs-cpp/Inputs/exprs3.cpp
@@ -0,0 +1,120 @@
+// Integer literals
+const char Ch1 = 'a';
+const signed char Ch2 = 'b';
+const unsigned char Ch3 = 'c';
+
+const wchar_t Ch4 = L'd';
+const signed wchar_t Ch5 = L'e';
+const unsigned wchar_t Ch6 = L'f';
+
+const short C1 = 12;
+const unsigned short C2 = 13;
+
+const int C3 = 12;
+const unsigned int C4 = 13;
+
+const long C5 = 22;
+const unsigned long C6 = 23;
+
+const long long C7 = 66;
+const unsigned long long C8 = 67;
+
+
+// String literals
+const char str1[] = "ABCD";
+const char str2[] = "ABCD" "0123";
+
+const wchar_t wstr1[] = L"DEF";
+const wchar_t wstr2[] = L"DEF" L"123";
+
+
+// Boolean literals
+const bool bval1 = true;
+const bool bval2 = false;
+
+// Floating Literals
+const float F1 = 12.2F;
+const double F2 = 1E4;
+const long double F3 = 1.2E-3L;
+
+
+// nullptr literal
+const void *vptr = nullptr;
+
+
+int glb_1[4] = { 10, 20, 30, 40 };
+
+struct S1 {
+ int a;
+ int b[3];
+};
+
+struct S2 {
+ int c;
+ S1 d;
+};
+
+S2 glb_2 = { 22, .d.a = 44, .d.b[0] = 55, .d.b[1] = 66 };
+
+void testNewThrowDelete() {
+ throw;
+ char *p = new char[10];
+ delete[] p;
+}
+
+int testArrayElement(int *x, int n) {
+ return x[n];
+}
+
+int testTernaryOp(int c, int x, int y) {
+ return c ? x : y;
+}
+
+S1 &testConstCast(const S1 &x) {
+ return const_cast<S1&>(x);
+}
+
+S1 &testStaticCast(S1 &x) {
+ return static_cast<S1&>(x);
+}
+
+S1 &testReinterpretCast(S1 &x) {
+ return reinterpret_cast<S1&>(x);
+}
+
+S1 &testDynamicCast(S1 &x) {
+ return dynamic_cast<S1&>(x);
+}
+
+int testScalarInit(int x) {
+ return int(x);
+}
+
+struct S {
+ float f;
+ double d;
+};
+struct T {
+ int i;
+ struct S s[10];
+};
+
+void testOffsetOf() {
+ __builtin_offsetof(struct T, s[2].d);
+}
+
+
+int testDefaultArg(int a = 2*2) {
+ return a;
+}
+
+template <typename T> // T has TemplateTypeParmType
+void testTemplateTypeParmType(int i);
+
+void useTemplateType() {
+ testTemplateTypeParmType<char>(4);
+}
+
+const bool ExpressionTrait = __is_lvalue_expr(1);
+const unsigned ArrayRank = __array_rank(int[10][20]);
+const unsigned ArrayExtent = __array_extent(int[10][20], 1);
diff --git a/test/ASTMerge/exprs-cpp/test.cpp b/test/ASTMerge/exprs-cpp/test.cpp
new file mode 100644
index 0000000000000..ba1f18b2c90c3
--- /dev/null
+++ b/test/ASTMerge/exprs-cpp/test.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -fcxx-exceptions -emit-pch -o %t.1.ast %S/Inputs/exprs3.cpp
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -fcxx-exceptions -ast-merge %t.1.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+static_assert(Ch1 == 'a');
+static_assert(Ch2 == 'b');
+static_assert(Ch3 == 'c');
+
+static_assert(Ch4 == L'd');
+static_assert(Ch5 == L'e');
+static_assert(Ch6 == L'f');
+
+static_assert(C1 == 12);
+static_assert(C2 == 13);
+
+static_assert(C3 == 12);
+static_assert(C4 == 13);
+
+static_assert(C5 == 22L);
+static_assert(C6 == 23L);
+
+static_assert(C7 == 66LL);
+static_assert(C8 == 67ULL);
+
+static_assert(bval1 == true);
+static_assert(bval2 == false);
+
+static_assert(ExpressionTrait == false);
+
+static_assert(ArrayRank == 2);
+static_assert(ArrayExtent == 20);
+
+void testImport(int *x, const S1 &cs1, S1 &s1) {
+ testNewThrowDelete();
+ testArrayElement(nullptr, 12);
+ testTernaryOp(0, 1, 2);
+ testConstCast(cs1);
+ testStaticCast(s1);
+ testReinterpretCast(s1);
+ testDynamicCast(s1);
+ testScalarInit(42);
+ testOffsetOf();
+ testDefaultArg(12);
+ useTemplateType();
+}
diff --git a/test/ASTMerge/exprs/Inputs/exprs1.c b/test/ASTMerge/exprs/Inputs/exprs1.c
new file mode 100644
index 0000000000000..1c268da15f3d3
--- /dev/null
+++ b/test/ASTMerge/exprs/Inputs/exprs1.c
@@ -0,0 +1,10 @@
+// Matching
+enum E0 {
+ E0_Val0 = 'a',
+ E0_Val1 = (17),
+ E0_Val2 = (1 << 2),
+ E0_Val3 = E0_Val2,
+ E0_Val4 = sizeof(int*),
+ E0_Val5 = (unsigned int)-1
+};
+
diff --git a/test/ASTMerge/exprs/Inputs/exprs2.c b/test/ASTMerge/exprs/Inputs/exprs2.c
new file mode 100644
index 0000000000000..1c268da15f3d3
--- /dev/null
+++ b/test/ASTMerge/exprs/Inputs/exprs2.c
@@ -0,0 +1,10 @@
+// Matching
+enum E0 {
+ E0_Val0 = 'a',
+ E0_Val1 = (17),
+ E0_Val2 = (1 << 2),
+ E0_Val3 = E0_Val2,
+ E0_Val4 = sizeof(int*),
+ E0_Val5 = (unsigned int)-1
+};
+
diff --git a/test/ASTMerge/exprs.c b/test/ASTMerge/exprs/test.c
index 7495bb6a874a9..7495bb6a874a9 100644
--- a/test/ASTMerge/exprs.c
+++ b/test/ASTMerge/exprs/test.c
diff --git a/test/ASTMerge/Inputs/function1.c b/test/ASTMerge/function/Inputs/function1.c
index 4523bd3d79bf7..4523bd3d79bf7 100644
--- a/test/ASTMerge/Inputs/function1.c
+++ b/test/ASTMerge/function/Inputs/function1.c
diff --git a/test/ASTMerge/Inputs/function2.c b/test/ASTMerge/function/Inputs/function2.c
index 6ca810a6f20bc..6ca810a6f20bc 100644
--- a/test/ASTMerge/Inputs/function2.c
+++ b/test/ASTMerge/function/Inputs/function2.c
diff --git a/test/ASTMerge/function.c b/test/ASTMerge/function/test.c
index 650f719d1fa8d..650f719d1fa8d 100644
--- a/test/ASTMerge/function.c
+++ b/test/ASTMerge/function/test.c
diff --git a/test/ASTMerge/Inputs/inheritance-base.cpp b/test/ASTMerge/inheritance/Inputs/inheritance-base.cpp
index 26fe42eb64da3..26fe42eb64da3 100644
--- a/test/ASTMerge/Inputs/inheritance-base.cpp
+++ b/test/ASTMerge/inheritance/Inputs/inheritance-base.cpp
diff --git a/test/ASTMerge/inheritance.cpp b/test/ASTMerge/inheritance/test.cpp
index 7fce82a736ab7..7fce82a736ab7 100644
--- a/test/ASTMerge/inheritance.cpp
+++ b/test/ASTMerge/inheritance/test.cpp
diff --git a/test/ASTMerge/Inputs/init-ctors-classes.cpp b/test/ASTMerge/init-ctors/Inputs/init-ctors-classes.cpp
index fd51f860634b5..fd51f860634b5 100644
--- a/test/ASTMerge/Inputs/init-ctors-classes.cpp
+++ b/test/ASTMerge/init-ctors/Inputs/init-ctors-classes.cpp
diff --git a/test/ASTMerge/init-ctors.cpp b/test/ASTMerge/init-ctors/test.cpp
index 5f0ba4decd9ff..5f0ba4decd9ff 100644
--- a/test/ASTMerge/init-ctors.cpp
+++ b/test/ASTMerge/init-ctors/test.cpp
diff --git a/test/ASTMerge/Inputs/interface1.m b/test/ASTMerge/interface/Inputs/interface1.m
index 5865c0eff0702..5865c0eff0702 100644
--- a/test/ASTMerge/Inputs/interface1.m
+++ b/test/ASTMerge/interface/Inputs/interface1.m
diff --git a/test/ASTMerge/Inputs/interface2.m b/test/ASTMerge/interface/Inputs/interface2.m
index 2133bd1381aa9..2133bd1381aa9 100644
--- a/test/ASTMerge/Inputs/interface2.m
+++ b/test/ASTMerge/interface/Inputs/interface2.m
diff --git a/test/ASTMerge/interface.m b/test/ASTMerge/interface/test.m
index 8ba5d73753a38..8ba5d73753a38 100644
--- a/test/ASTMerge/interface.m
+++ b/test/ASTMerge/interface/test.m
diff --git a/test/ASTMerge/macro/Inputs/macro.modulemap b/test/ASTMerge/macro/Inputs/macro.modulemap
new file mode 100644
index 0000000000000..dba1f2207f159
--- /dev/null
+++ b/test/ASTMerge/macro/Inputs/macro.modulemap
@@ -0,0 +1,4 @@
+module macro1 [extern_c] {
+ header "macro1.h"
+ export *
+}
diff --git a/test/ASTMerge/macro/Inputs/macro1.h b/test/ASTMerge/macro/Inputs/macro1.h
new file mode 100644
index 0000000000000..961339496787c
--- /dev/null
+++ b/test/ASTMerge/macro/Inputs/macro1.h
@@ -0,0 +1,5 @@
+typedef void *VoidRef;
+
+void maybeNull(
+ int i,
+ _Nullable VoidRef *_Nullable);
diff --git a/test/ASTMerge/macro/Inputs/macro1.m b/test/ASTMerge/macro/Inputs/macro1.m
new file mode 100644
index 0000000000000..2612613bd0be5
--- /dev/null
+++ b/test/ASTMerge/macro/Inputs/macro1.m
@@ -0,0 +1,5 @@
+@import macro1;
+
+void foo() {
+ maybeNull(0, 0);
+}
diff --git a/test/ASTMerge/macro/Inputs/macro2.m b/test/ASTMerge/macro/Inputs/macro2.m
new file mode 100644
index 0000000000000..b5b155a95b526
--- /dev/null
+++ b/test/ASTMerge/macro/Inputs/macro2.m
@@ -0,0 +1,5 @@
+void foo();
+
+void bar() {
+ foo();
+}
diff --git a/test/ASTMerge/macro/test.m b/test/ASTMerge/macro/test.m
new file mode 100644
index 0000000000000..77e596d3baeda
--- /dev/null
+++ b/test/ASTMerge/macro/test.m
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/cache
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.1.ast %S/Inputs/macro1.m
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.2.ast %S/Inputs/macro2.m
+// RUN: %clang_cc1 -fmodules -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
diff --git a/test/ASTMerge/Inputs/namespace1.cpp b/test/ASTMerge/namespace/Inputs/namespace1.cpp
index 1ff84f3111c92..1ff84f3111c92 100644
--- a/test/ASTMerge/Inputs/namespace1.cpp
+++ b/test/ASTMerge/namespace/Inputs/namespace1.cpp
diff --git a/test/ASTMerge/Inputs/namespace2.cpp b/test/ASTMerge/namespace/Inputs/namespace2.cpp
index 80429f700b13a..80429f700b13a 100644
--- a/test/ASTMerge/Inputs/namespace2.cpp
+++ b/test/ASTMerge/namespace/Inputs/namespace2.cpp
diff --git a/test/ASTMerge/namespace.cpp b/test/ASTMerge/namespace/test.cpp
index 8cc0fa2a6d973..8cc0fa2a6d973 100644
--- a/test/ASTMerge/namespace.cpp
+++ b/test/ASTMerge/namespace/test.cpp
diff --git a/test/ASTMerge/Inputs/property1.m b/test/ASTMerge/property/Inputs/property1.m
index 22fe0a02220cf..22fe0a02220cf 100644
--- a/test/ASTMerge/Inputs/property1.m
+++ b/test/ASTMerge/property/Inputs/property1.m
diff --git a/test/ASTMerge/Inputs/property2.m b/test/ASTMerge/property/Inputs/property2.m
index 64a03fb04ec37..64a03fb04ec37 100644
--- a/test/ASTMerge/Inputs/property2.m
+++ b/test/ASTMerge/property/Inputs/property2.m
diff --git a/test/ASTMerge/property.m b/test/ASTMerge/property/test.m
index 4948023476963..4948023476963 100644
--- a/test/ASTMerge/property.m
+++ b/test/ASTMerge/property/test.m
diff --git a/test/ASTMerge/Inputs/struct1.c b/test/ASTMerge/struct/Inputs/struct1.c
index af2af8abc42ad..af2af8abc42ad 100644
--- a/test/ASTMerge/Inputs/struct1.c
+++ b/test/ASTMerge/struct/Inputs/struct1.c
diff --git a/test/ASTMerge/Inputs/struct2.c b/test/ASTMerge/struct/Inputs/struct2.c
index 4b43df71d8d68..4b43df71d8d68 100644
--- a/test/ASTMerge/Inputs/struct2.c
+++ b/test/ASTMerge/struct/Inputs/struct2.c
diff --git a/test/ASTMerge/struct.c b/test/ASTMerge/struct/test.c
index 4f41cea26b189..4f41cea26b189 100644
--- a/test/ASTMerge/struct.c
+++ b/test/ASTMerge/struct/test.c
diff --git a/test/ASTMerge/Inputs/typedef1.c b/test/ASTMerge/typedef/Inputs/typedef1.c
index 56576756856df..56576756856df 100644
--- a/test/ASTMerge/Inputs/typedef1.c
+++ b/test/ASTMerge/typedef/Inputs/typedef1.c
diff --git a/test/ASTMerge/Inputs/typedef2.c b/test/ASTMerge/typedef/Inputs/typedef2.c
index 129d7101e91e6..129d7101e91e6 100644
--- a/test/ASTMerge/Inputs/typedef2.c
+++ b/test/ASTMerge/typedef/Inputs/typedef2.c
diff --git a/test/ASTMerge/typedef.c b/test/ASTMerge/typedef/test.c
index 79e4723118744..79e4723118744 100644
--- a/test/ASTMerge/typedef.c
+++ b/test/ASTMerge/typedef/test.c
diff --git a/test/ASTMerge/Inputs/var1.c b/test/ASTMerge/var/Inputs/var1.c
index 4f5cbe16ab6cc..4f5cbe16ab6cc 100644
--- a/test/ASTMerge/Inputs/var1.c
+++ b/test/ASTMerge/var/Inputs/var1.c
diff --git a/test/ASTMerge/Inputs/var1.h b/test/ASTMerge/var/Inputs/var1.h
index 1518e17ef0c88..1518e17ef0c88 100644
--- a/test/ASTMerge/Inputs/var1.h
+++ b/test/ASTMerge/var/Inputs/var1.h
diff --git a/test/ASTMerge/Inputs/var2.c b/test/ASTMerge/var/Inputs/var2.c
index 01986e4208caa..01986e4208caa 100644
--- a/test/ASTMerge/Inputs/var2.c
+++ b/test/ASTMerge/var/Inputs/var2.c
diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var/test.c
index e14dc37edac7d..e14dc37edac7d 100644
--- a/test/ASTMerge/var.c
+++ b/test/ASTMerge/var/test.c