summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/system-out-of-date/X.h1
-rw-r--r--clang/test/Modules/Inputs/system-out-of-date/Y.h1
-rw-r--r--clang/test/Modules/Inputs/system-out-of-date/Z.h1
-rw-r--r--clang/test/Modules/Inputs/system-out-of-date/module.map12
-rw-r--r--clang/test/Modules/Inputs/warning-mismatch/Mismatch.h1
-rw-r--r--clang/test/Modules/Inputs/warning-mismatch/System.h2
-rw-r--r--clang/test/Modules/Inputs/warning-mismatch/module.modulemap7
-rw-r--r--clang/test/Modules/outofdate-rebuild.m15
-rw-r--r--clang/test/Modules/system-out-of-date-test.m17
-rw-r--r--clang/test/Modules/warning-mismatch.m13
10 files changed, 70 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/system-out-of-date/X.h b/clang/test/Modules/Inputs/system-out-of-date/X.h
new file mode 100644
index 00000000000..edcfa18f5af
--- /dev/null
+++ b/clang/test/Modules/Inputs/system-out-of-date/X.h
@@ -0,0 +1 @@
+#import <Y.h>
diff --git a/clang/test/Modules/Inputs/system-out-of-date/Y.h b/clang/test/Modules/Inputs/system-out-of-date/Y.h
new file mode 100644
index 00000000000..90fe1bcc585
--- /dev/null
+++ b/clang/test/Modules/Inputs/system-out-of-date/Y.h
@@ -0,0 +1 @@
+//empty
diff --git a/clang/test/Modules/Inputs/system-out-of-date/Z.h b/clang/test/Modules/Inputs/system-out-of-date/Z.h
new file mode 100644
index 00000000000..edcfa18f5af
--- /dev/null
+++ b/clang/test/Modules/Inputs/system-out-of-date/Z.h
@@ -0,0 +1 @@
+#import <Y.h>
diff --git a/clang/test/Modules/Inputs/system-out-of-date/module.map b/clang/test/Modules/Inputs/system-out-of-date/module.map
new file mode 100644
index 00000000000..0c0f42a5d01
--- /dev/null
+++ b/clang/test/Modules/Inputs/system-out-of-date/module.map
@@ -0,0 +1,12 @@
+module X [system] {
+ header "X.h" // imports Y
+ export *
+}
+module Y {
+ header "Y.h"
+ export *
+}
+module Z {
+ header "Z.h" // imports Y
+ export *
+}
diff --git a/clang/test/Modules/Inputs/warning-mismatch/Mismatch.h b/clang/test/Modules/Inputs/warning-mismatch/Mismatch.h
new file mode 100644
index 00000000000..a07b0ee31ea
--- /dev/null
+++ b/clang/test/Modules/Inputs/warning-mismatch/Mismatch.h
@@ -0,0 +1 @@
+struct Mismatch { int i; };
diff --git a/clang/test/Modules/Inputs/warning-mismatch/System.h b/clang/test/Modules/Inputs/warning-mismatch/System.h
new file mode 100644
index 00000000000..8e69e704c75
--- /dev/null
+++ b/clang/test/Modules/Inputs/warning-mismatch/System.h
@@ -0,0 +1,2 @@
+#import "Mismatch.h"
+struct System { int i; };
diff --git a/clang/test/Modules/Inputs/warning-mismatch/module.modulemap b/clang/test/Modules/Inputs/warning-mismatch/module.modulemap
new file mode 100644
index 00000000000..c22cde45978
--- /dev/null
+++ b/clang/test/Modules/Inputs/warning-mismatch/module.modulemap
@@ -0,0 +1,7 @@
+module System [system] {
+ header "System.h"
+}
+
+module Mismatch {
+ header "Mismatch.h"
+}
diff --git a/clang/test/Modules/outofdate-rebuild.m b/clang/test/Modules/outofdate-rebuild.m
new file mode 100644
index 00000000000..510325f62dc
--- /dev/null
+++ b/clang/test/Modules/outofdate-rebuild.m
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t.cache
+// RUN: echo "@import CoreText;" > %t.m
+// 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 when ModuleManager removes an
+// entry from the PCMCache without notifying its parent ASTReader.
+@import Cocoa;
diff --git a/clang/test/Modules/system-out-of-date-test.m b/clang/test/Modules/system-out-of-date-test.m
new file mode 100644
index 00000000000..e78df7b3b3e
--- /dev/null
+++ b/clang/test/Modules/system-out-of-date-test.m
@@ -0,0 +1,17 @@
+// RUN: rm -rf %t.cache
+// RUN: echo '@import X;' | \
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \
+// 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;
+
+#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/clang/test/Modules/warning-mismatch.m b/clang/test/Modules/warning-mismatch.m
new file mode 100644
index 00000000000..dd7c7f82ec6
--- /dev/null
+++ b/clang/test/Modules/warning-mismatch.m
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t.cache
+// RUN: echo "@import Mismatch;" >%t.m
+// 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.
+@import Mismatch;
+@import System;
OpenPOWER on IntegriCloud