aboutsummaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/Inputs/Conflicts/conflict_a.h1
-rw-r--r--test/Modules/Inputs/Conflicts/conflict_b.h1
-rw-r--r--test/Modules/Inputs/Conflicts/module.map10
-rw-r--r--test/Modules/Inputs/Modified/B.h3
-rw-r--r--test/Modules/Inputs/Modified/module.map7
-rw-r--r--test/Modules/Inputs/ModuleDiags/has_errors.h2
-rw-r--r--test/Modules/Inputs/ModuleDiags/has_warnings.h3
-rw-r--r--test/Modules/Inputs/ModuleDiags/module.map7
-rw-r--r--test/Modules/Inputs/StdDef/module.map11
-rw-r--r--test/Modules/Inputs/StdDef/other.h2
-rw-r--r--test/Modules/Inputs/StdDef/size_t.h4
-rw-r--r--test/Modules/Inputs/System/usr/include/dbl_max.h1
-rw-r--r--test/Modules/Inputs/System/usr/include/module.map11
-rw-r--r--test/Modules/Inputs/System/usr/include/uses_other_constants.h3
-rw-r--r--test/Modules/Inputs/builtin.h3
-rw-r--r--test/Modules/Inputs/builtin_sub.h4
-rw-r--r--test/Modules/Inputs/config.h7
-rw-r--r--test/Modules/Inputs/diag_pragma.h3
-rw-r--r--test/Modules/Inputs/linkage-merge-bar.h3
-rw-r--r--test/Modules/Inputs/linkage-merge-foo.h2
-rw-r--r--test/Modules/Inputs/macros_left.h2
-rw-r--r--test/Modules/Inputs/macros_right.h2
-rw-r--r--test/Modules/Inputs/macros_top.h4
-rw-r--r--test/Modules/Inputs/module.map26
-rw-r--r--test/Modules/Inputs/oldname/module.map4
-rw-r--r--test/Modules/Inputs/oldname/new_name.h1
-rw-r--r--test/Modules/auto-module-import.m4
-rw-r--r--test/Modules/autolink.m6
-rw-r--r--test/Modules/builtins.m16
-rw-r--r--test/Modules/compiler_builtins.m1
-rw-r--r--test/Modules/config_macros.m28
-rw-r--r--test/Modules/conflicts.m7
-rw-r--r--test/Modules/cstd.m7
-rw-r--r--test/Modules/cycles.c4
-rw-r--r--test/Modules/decldef.m3
-rw-r--r--test/Modules/decldef.mm3
-rw-r--r--test/Modules/diag-pragma.c13
-rw-r--r--test/Modules/diamond-pch.c25
-rw-r--r--test/Modules/diamond.c22
-rw-r--r--test/Modules/driver.c2
-rw-r--r--test/Modules/linkage-merge.cpp12
-rw-r--r--test/Modules/linkage-merge.m23
-rw-r--r--test/Modules/lookup.cpp2
-rw-r--r--test/Modules/lookup.m18
-rw-r--r--test/Modules/macros.c35
-rw-r--r--test/Modules/method_pool.m8
-rw-r--r--test/Modules/modify-module.m15
-rw-r--r--test/Modules/module-private.cpp2
-rw-r--r--test/Modules/module_file_info.m34
-rw-r--r--test/Modules/namespaces.cpp4
-rw-r--r--test/Modules/normal-module-map.cpp6
-rw-r--r--test/Modules/objc-categories.m9
-rw-r--r--test/Modules/on-demand-build.m2
-rw-r--r--test/Modules/prune.m46
-rw-r--r--test/Modules/redecl-merge.m18
-rw-r--r--test/Modules/redecls/a.h3
-rw-r--r--test/Modules/redecls/b.h1
-rw-r--r--test/Modules/redecls/main.m27
-rw-r--r--test/Modules/redecls/module.map2
-rw-r--r--test/Modules/renamed.m8
-rw-r--r--test/Modules/serialized-diags.m32
-rw-r--r--test/Modules/stddef.m7
-rw-r--r--test/Modules/subframeworks.m2
-rw-r--r--test/Modules/system_version.m32
64 files changed, 501 insertions, 115 deletions
diff --git a/test/Modules/Inputs/Conflicts/conflict_a.h b/test/Modules/Inputs/Conflicts/conflict_a.h
new file mode 100644
index 0000000000..c16b5f5ef2
--- /dev/null
+++ b/test/Modules/Inputs/Conflicts/conflict_a.h
@@ -0,0 +1 @@
+int conflict_a;
diff --git a/test/Modules/Inputs/Conflicts/conflict_b.h b/test/Modules/Inputs/Conflicts/conflict_b.h
new file mode 100644
index 0000000000..4baf16f88e
--- /dev/null
+++ b/test/Modules/Inputs/Conflicts/conflict_b.h
@@ -0,0 +1 @@
+int conflict_b;
diff --git a/test/Modules/Inputs/Conflicts/module.map b/test/Modules/Inputs/Conflicts/module.map
new file mode 100644
index 0000000000..e6aafaccec
--- /dev/null
+++ b/test/Modules/Inputs/Conflicts/module.map
@@ -0,0 +1,10 @@
+module Conflicts {
+ explicit module A {
+ header "conflict_a.h"
+ conflict B, "we just don't like B"
+ }
+
+ module B {
+ header "conflict_b.h"
+ }
+}
diff --git a/test/Modules/Inputs/Modified/B.h b/test/Modules/Inputs/Modified/B.h
index d1c8bb5e8e..52526b7f3a 100644
--- a/test/Modules/Inputs/Modified/B.h
+++ b/test/Modules/Inputs/Modified/B.h
@@ -1,2 +1,3 @@
-#include "A.h"
+@import ModA;
+
int getB();
diff --git a/test/Modules/Inputs/Modified/module.map b/test/Modules/Inputs/Modified/module.map
index d9aed01430..27b0d7062c 100644
--- a/test/Modules/Inputs/Modified/module.map
+++ b/test/Modules/Inputs/Modified/module.map
@@ -1,2 +1,5 @@
-module A { header "A.h" }
-module B { header "B.h" }
+module ModA { header "A.h" }
+module ModB {
+ header "B.h"
+ export *
+}
diff --git a/test/Modules/Inputs/ModuleDiags/has_errors.h b/test/Modules/Inputs/ModuleDiags/has_errors.h
new file mode 100644
index 0000000000..2c0929a6f5
--- /dev/null
+++ b/test/Modules/Inputs/ModuleDiags/has_errors.h
@@ -0,0 +1,2 @@
+static void foo(void) { }
+static void foo(void) { }
diff --git a/test/Modules/Inputs/ModuleDiags/has_warnings.h b/test/Modules/Inputs/ModuleDiags/has_warnings.h
new file mode 100644
index 0000000000..87112be695
--- /dev/null
+++ b/test/Modules/Inputs/ModuleDiags/has_warnings.h
@@ -0,0 +1,3 @@
+
+int int_val;
+float *float_ptr = &int_val;
diff --git a/test/Modules/Inputs/ModuleDiags/module.map b/test/Modules/Inputs/ModuleDiags/module.map
new file mode 100644
index 0000000000..09b25088e6
--- /dev/null
+++ b/test/Modules/Inputs/ModuleDiags/module.map
@@ -0,0 +1,7 @@
+module HasWarnings {
+ header "has_warnings.h"
+}
+
+module HasErrors {
+ header "has_errors.h"
+}
diff --git a/test/Modules/Inputs/StdDef/module.map b/test/Modules/Inputs/StdDef/module.map
new file mode 100644
index 0000000000..69c69eac35
--- /dev/null
+++ b/test/Modules/Inputs/StdDef/module.map
@@ -0,0 +1,11 @@
+module StdDef {
+ module SizeT {
+ header "size_t.h"
+ export *
+ }
+
+ module Other {
+ header "other.h"
+ export *
+ }
+}
diff --git a/test/Modules/Inputs/StdDef/other.h b/test/Modules/Inputs/StdDef/other.h
new file mode 100644
index 0000000000..f29f6366cc
--- /dev/null
+++ b/test/Modules/Inputs/StdDef/other.h
@@ -0,0 +1,2 @@
+#include <stddef.h>
+
diff --git a/test/Modules/Inputs/StdDef/size_t.h b/test/Modules/Inputs/StdDef/size_t.h
new file mode 100644
index 0000000000..9ac61c5e0d
--- /dev/null
+++ b/test/Modules/Inputs/StdDef/size_t.h
@@ -0,0 +1,4 @@
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef __SIZE_TYPE__ size_t;
+#endif
diff --git a/test/Modules/Inputs/System/usr/include/dbl_max.h b/test/Modules/Inputs/System/usr/include/dbl_max.h
new file mode 100644
index 0000000000..9a020d1bf5
--- /dev/null
+++ b/test/Modules/Inputs/System/usr/include/dbl_max.h
@@ -0,0 +1 @@
+#define DBL_MAX __DBL_MAX__
diff --git a/test/Modules/Inputs/System/usr/include/module.map b/test/Modules/Inputs/System/usr/include/module.map
index 884b59c80c..9b2f3af2ba 100644
--- a/test/Modules/Inputs/System/usr/include/module.map
+++ b/test/Modules/Inputs/System/usr/include/module.map
@@ -19,3 +19,14 @@ module cstd [system] {
header "stdint.h"
}
}
+
+module other_constants {
+ explicit module dbl_max {
+ header "dbl_max.h"
+ }
+}
+
+module uses_other_constants {
+ header "uses_other_constants.h"
+ export *
+}
diff --git a/test/Modules/Inputs/System/usr/include/uses_other_constants.h b/test/Modules/Inputs/System/usr/include/uses_other_constants.h
new file mode 100644
index 0000000000..f6d4cca9f8
--- /dev/null
+++ b/test/Modules/Inputs/System/usr/include/uses_other_constants.h
@@ -0,0 +1,3 @@
+@import other_constants;
+#include <float.h>
+
diff --git a/test/Modules/Inputs/builtin.h b/test/Modules/Inputs/builtin.h
new file mode 100644
index 0000000000..7be90177d1
--- /dev/null
+++ b/test/Modules/Inputs/builtin.h
@@ -0,0 +1,3 @@
+int i;
+int *p = &i;
+
diff --git a/test/Modules/Inputs/builtin_sub.h b/test/Modules/Inputs/builtin_sub.h
new file mode 100644
index 0000000000..79e3c03325
--- /dev/null
+++ b/test/Modules/Inputs/builtin_sub.h
@@ -0,0 +1,4 @@
+int getBos1(void) {
+ return __builtin_object_size(p, 0);
+}
+
diff --git a/test/Modules/Inputs/config.h b/test/Modules/Inputs/config.h
new file mode 100644
index 0000000000..f2dfda64c3
--- /dev/null
+++ b/test/Modules/Inputs/config.h
@@ -0,0 +1,7 @@
+#ifdef WANT_FOO
+int* foo();
+#endif
+
+#ifdef WANT_BAR
+char *bar();
+#endif
diff --git a/test/Modules/Inputs/diag_pragma.h b/test/Modules/Inputs/diag_pragma.h
new file mode 100644
index 0000000000..a8f958994c
--- /dev/null
+++ b/test/Modules/Inputs/diag_pragma.h
@@ -0,0 +1,3 @@
+#define DIAG_PRAGMA_MACRO 1
+
+#pragma clang diagnostic ignored "-Wparentheses"
diff --git a/test/Modules/Inputs/linkage-merge-bar.h b/test/Modules/Inputs/linkage-merge-bar.h
new file mode 100644
index 0000000000..cc528f7752
--- /dev/null
+++ b/test/Modules/Inputs/linkage-merge-bar.h
@@ -0,0 +1,3 @@
+#include <linkage-merge-foo.h>
+
+using ::g;
diff --git a/test/Modules/Inputs/linkage-merge-foo.h b/test/Modules/Inputs/linkage-merge-foo.h
new file mode 100644
index 0000000000..9cb62d2c0c
--- /dev/null
+++ b/test/Modules/Inputs/linkage-merge-foo.h
@@ -0,0 +1,2 @@
+int f();
+static int g(int);
diff --git a/test/Modules/Inputs/macros_left.h b/test/Modules/Inputs/macros_left.h
index a8aac75a2f..076b0464e6 100644
--- a/test/Modules/Inputs/macros_left.h
+++ b/test/Modules/Inputs/macros_left.h
@@ -12,3 +12,5 @@
#define LEFT_RIGHT_DIFFERENT3 float
#define LEFT_RIGHT_DIFFERENT float
+
+#define FN_ADD(a,b) (a+b)
diff --git a/test/Modules/Inputs/macros_right.h b/test/Modules/Inputs/macros_right.h
index 445f579cf6..dbbd2c3643 100644
--- a/test/Modules/Inputs/macros_right.h
+++ b/test/Modules/Inputs/macros_right.h
@@ -15,3 +15,5 @@
#undef TOP_RIGHT_REDEF
#define TOP_RIGHT_REDEF float
+
+#define FN_ADD(x, y) (x+y)
diff --git a/test/Modules/Inputs/macros_top.h b/test/Modules/Inputs/macros_top.h
index 9c3f3c071f..dd303ffee4 100644
--- a/test/Modules/Inputs/macros_top.h
+++ b/test/Modules/Inputs/macros_top.h
@@ -8,8 +8,8 @@
-
-
+#define TOP_RIGHT_REDEF float
+// The last definition will be exported from the sub-module.
#define TOP_RIGHT_REDEF int
#define TOP_RIGHT_UNDEF int
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 53f2fd65d3..d20521f9c7 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -183,3 +183,29 @@ module cxx_inline_namespace {
module cxx_linkage_cache {
header "cxx-linkage-cache.h"
}
+
+module config {
+ header "config.h"
+ config_macros [exhaustive] WANT_FOO, WANT_BAR
+}
+
+module diag_pragma {
+ header "diag_pragma.h"
+}
+
+module builtin {
+ header "builtin.h"
+ explicit module sub {
+ header "builtin_sub.h"
+ }
+}
+
+module linkage_merge {
+ explicit module foo {
+ header "linkage-merge-foo.h"
+ }
+ explicit module bar {
+ header "linkage-merge-bar.h"
+ }
+
+}
diff --git a/test/Modules/Inputs/oldname/module.map b/test/Modules/Inputs/oldname/module.map
new file mode 100644
index 0000000000..5812f869b3
--- /dev/null
+++ b/test/Modules/Inputs/oldname/module.map
@@ -0,0 +1,4 @@
+module NewName {
+ header "new_name.h"
+ export *
+}
diff --git a/test/Modules/Inputs/oldname/new_name.h b/test/Modules/Inputs/oldname/new_name.h
new file mode 100644
index 0000000000..8bf2f1c8c3
--- /dev/null
+++ b/test/Modules/Inputs/oldname/new_name.h
@@ -0,0 +1 @@
+int same_api;
diff --git a/test/Modules/auto-module-import.m b/test/Modules/auto-module-import.m
index 4bd3c5279c..7351828182 100644
--- a/test/Modules/auto-module-import.m
+++ b/test/Modules/auto-module-import.m
@@ -1,10 +1,10 @@
-// other file: expected-note{{'no_umbrella_A_private' declared here}}
-
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify
#include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}}
+// expected-note@Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h:1{{'no_umbrella_A_private' declared here}}
+
#ifdef MODULE_H_MACRO
# error MODULE_H_MACRO should have been hidden
#endif
diff --git a/test/Modules/autolink.m b/test/Modules/autolink.m
index 7f75473cbb..4bf9d592a8 100644
--- a/test/Modules/autolink.m
+++ b/test/Modules/autolink.m
@@ -1,5 +1,6 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -fmodules-autolink -F %S/Inputs -I %S/Inputs %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs %s | FileCheck --check-prefix=CHECK-AUTOLINK-DISABLED %s
@import autolink.sub2;
@@ -38,3 +39,6 @@ int use_no_umbrella() {
// CHECK: ![[DEPENDSONMODULE]] = metadata !{metadata !"-framework", metadata !"DependsOnModule"}
// CHECK: ![[MODULE]] = metadata !{metadata !"-framework", metadata !"Module"}
// CHECK: ![[NOUMBRELLA]] = metadata !{metadata !"-framework", metadata !"NoUmbrella"}
+
+// CHECK-AUTOLINK-DISABLED: !llvm.module.flags
+// CHECK-AUTOLINK-DISABLED-NOT: "Linker Options"
diff --git a/test/Modules/builtins.m b/test/Modules/builtins.m
new file mode 100644
index 0000000000..40b4f9c743
--- /dev/null
+++ b/test/Modules/builtins.m
@@ -0,0 +1,16 @@
+@import builtin;
+
+int foo() {
+ return __builtin_object_size(p, 0);
+}
+
+@import builtin.sub;
+
+int bar() {
+ return __builtin_object_size(p, 0);
+}
+
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify
+// expected-no-diagnostics
diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m
index 5ea7d795c7..4b8cb5bdc5 100644
--- a/test/Modules/compiler_builtins.m
+++ b/test/Modules/compiler_builtins.m
@@ -2,7 +2,6 @@
// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify
// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify
// expected-no-diagnostics
-// XFAIL: win32
#ifdef __SSE__
@import _Builtin_intrinsics.intel.sse;
diff --git a/test/Modules/config_macros.m b/test/Modules/config_macros.m
new file mode 100644
index 0000000000..200744d614
--- /dev/null
+++ b/test/Modules/config_macros.m
@@ -0,0 +1,28 @@
+@import config;
+
+int *test_foo() {
+ return foo();
+}
+
+char *test_bar() {
+ return bar(); // expected-warning{{implicit declaration of function 'bar' is invalid in C99}} \
+ // expected-warning{{incompatible integer to pointer conversion}}
+}
+
+#undef WANT_FOO // expected-note{{macro was #undef'd here}}
+@import config; // expected-warning{{#undef of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-UWANT_FOO' on the command line to configure the module}}
+
+#define WANT_FOO 2 // expected-note{{macro was defined here}}
+@import config; // expected-warning{{definition of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-DWANT_FOO=...' on the command line to configure the module}}
+
+#undef WANT_FOO
+#define WANT_FOO 1
+@import config; // okay
+
+#define WANT_BAR 1 // expected-note{{macro was defined here}}
+@import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}}
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -DWANT_FOO=1 %s -verify
+
diff --git a/test/Modules/conflicts.m b/test/Modules/conflicts.m
new file mode 100644
index 0000000000..2388e6f1d1
--- /dev/null
+++ b/test/Modules/conflicts.m
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -I %S/Inputs/Conflicts %s -verify
+
+@import Conflicts;
+
+@import Conflicts.A; // expected-warning{{module 'Conflicts.A' conflicts with already-imported module 'Conflicts.B': we just don't like B}}
+
diff --git a/test/Modules/cstd.m b/test/Modules/cstd.m
index 6d896a9155..3d1dcf38e3 100644
--- a/test/Modules/cstd.m
+++ b/test/Modules/cstd.m
@@ -1,6 +1,9 @@
// RUN: rm -rf %t
// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s
+@import uses_other_constants;
+const double other_value = DBL_MAX;
+
// Supplied by compiler, but referenced from the "/usr/include" module map.
@import cstd.float_constants;
@@ -16,7 +19,7 @@ void test_fprintf(FILE *file) {
// Supplied by compiler, which forwards to the "/usr/include" version.
@import cstd.stdint;
-my_awesome_nonstandard_integer_type value;
+my_awesome_nonstandard_integer_type value2;
// Supplied by the compiler; that version wins.
@import cstd.stdbool;
@@ -25,5 +28,3 @@ my_awesome_nonstandard_integer_type value;
# error "bool was not defined!"
#endif
-
-
diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c
index 4326e76a75..5f83092c95 100644
--- a/test/Modules/cycles.c
+++ b/test/Modules/cycles.c
@@ -6,8 +6,8 @@
// CHECK: While building module 'MutuallyRecursive1' imported from
// CHECK: While building module 'MutuallyRecursive2' imported from
// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
-// CHECK: While building module 'MutuallyRecursive1' imported from
// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2'
// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1'
-// CHECK-NOT: error:
+// CHECK: 3 errors generated
+
diff --git a/test/Modules/decldef.m b/test/Modules/decldef.m
index 7fb8a61386..7ed82b57e9 100644
--- a/test/Modules/decldef.m
+++ b/test/Modules/decldef.m
@@ -1,8 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
-
-// In other file: expected-note {{previous definition is here}}
+// expected-note@Inputs/def.h:5 {{previous definition is here}}
@class Def;
Def *def;
diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm
index 732c2a27e2..593f53b2c6 100644
--- a/test/Modules/decldef.mm
+++ b/test/Modules/decldef.mm
@@ -1,8 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
-
-// In other file: expected-note {{previous definition is here}}
+// expected-note@Inputs/def.h:5 {{previous definition is here}}
@class Def;
Def *def;
diff --git a/test/Modules/diag-pragma.c b/test/Modules/diag-pragma.c
new file mode 100644
index 0000000000..7ec3400bba
--- /dev/null
+++ b/test/Modules/diag-pragma.c
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t %s
+// FIXME: When we have a syntax for modules in C, use that.
+
+@import diag_pragma;
+
+int foo(int x) {
+ if (x = DIAG_PRAGMA_MACRO) // expected-warning {{using the result of an assignment as a condition without parentheses}} \
+ // expected-note {{place parentheses}} expected-note {{use '=='}}
+ return 0;
+ return 1;
+}
diff --git a/test/Modules/diamond-pch.c b/test/Modules/diamond-pch.c
index 079f6afa9c..e7ad02dbe4 100644
--- a/test/Modules/diamond-pch.c
+++ b/test/Modules/diamond-pch.c
@@ -1,14 +1,20 @@
-
-
-
-// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -o %t.pch %S/Inputs/diamond.h
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -verify
+// FIXME: When we have a syntax for modules in C, use that.
void test_diamond(int i, float f, double d, char c) {
top(&i);
left(&f);
right(&d);
bottom(&c);
- bottom(&d); // expected-warning{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ bottom(&d);
+ // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}}
// Names in multiple places in the diamond.
top_left(&c);
@@ -17,12 +23,3 @@ void test_diamond(int i, float f, double d, char c) {
struct left_and_right lr;
lr.left = 17;
}
-
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -o %t.pch %S/Inputs/diamond.h
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -verify
-// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c
index 0bac1b7596..89d5bc0dda 100644
--- a/test/Modules/diamond.c
+++ b/test/Modules/diamond.c
@@ -1,7 +1,10 @@
-
-
-
-// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t %s -verify
+// FIXME: When we have a syntax for modules in C, use that.
@import diamond_bottom;
@@ -10,7 +13,9 @@ void test_diamond(int i, float f, double d, char c) {
left(&f);
right(&d);
bottom(&c);
- bottom(&d); // expected-warning{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ bottom(&d);
+ // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}}
// Names in multiple places in the diamond.
top_left(&c);
@@ -20,10 +25,3 @@ void test_diamond(int i, float f, double d, char c) {
lr.left = 17;
}
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t %s -verify
-// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/driver.c b/test/Modules/driver.c
index 0a787b996a..08fdaab441 100644
--- a/test/Modules/driver.c
+++ b/test/Modules/driver.c
@@ -1,6 +1,6 @@
// RUN: %clang -fmodules %s -### 2>&1 | FileCheck -check-prefix NO_MODULE_CACHE %s
// RUN: %clang -fmodules -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix WITH_MODULE_CACHE %s
-// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*clang-module-cache"}}
+// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}}
// CHECK-WITH_MODULE_CACHE: {{clang.*"-fmodules-cache-path=blarg"}}
diff --git a/test/Modules/linkage-merge.cpp b/test/Modules/linkage-merge.cpp
new file mode 100644
index 0000000000..9cc9ae64bf
--- /dev/null
+++ b/test/Modules/linkage-merge.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -verify -fmodules -fmodules-cache-path=%t -I %S/Inputs %s
+
+#include "linkage-merge-bar.h"
+
+static int f(int);
+int f(int);
+
+static void g(int);
+// expected-error@-1 {{declaration conflicts with target of using declaration already in scope}}
+// expected-note@Inputs/linkage-merge-foo.h:2 {{target of using declaration}}
+// expected-note@Inputs/linkage-merge-bar.h:3 {{using declaration}}
diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m
index 16e2205078..e838ca1018 100644
--- a/test/Modules/linkage-merge.m
+++ b/test/Modules/linkage-merge.m
@@ -1,27 +1,26 @@
-// In module: expected-note{{previous declaration}}
-
-
-
-
-// In module: expected-note{{previous definition is here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify
// Test redeclarations of functions where the original declaration is
// still hidden.
@import linkage_merge_left; // excludes "sub"
-extern int f0(float); // expected-error{{conflicting types for 'f0'}}
+extern int f0(float);
+// expected-error@-1{{conflicting types for 'f0'}}
+// expected-note@Inputs/linkage-merge-sub.h:1{{previous declaration}}
+
static int f1(float); // okay: considered distinct
static int f2(float); // okay: considered distinct
extern int f3(float); // okay: considered distinct
-extern float v0; // expected-error{{redefinition of 'v0' with a different type: 'float' vs 'int'}}
+extern float v0;
+// expected-error@-1{{redefinition of 'v0' with a different type: 'float' vs 'int'}}
+// expected-note@Inputs/linkage-merge-sub.h:6{{previous definition is here}}
+
static float v1;
static float v2;
extern float v3;
typedef float T0;
-
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify
diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp
index 002b6d1556..efd88f47e3 100644
--- a/test/Modules/lookup.cpp
+++ b/test/Modules/lookup.cpp
@@ -5,7 +5,7 @@ import lookup_left_cxx;
#define IMPORT(X) @import X
IMPORT(lookup_right_cxx);
-// in lookup_left.hpp: expected-warning@3 {{weak identifier 'weak_identifier' never declared}}
+// expected-warning@Inputs/lookup_left.hpp:3 {{weak identifier 'weak_identifier' never declared}}
void test(int i, float f) {
// unqualified lookup
diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m
index abe95420d4..54c7491390 100644
--- a/test/Modules/lookup.m
+++ b/test/Modules/lookup.m
@@ -1,19 +1,19 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -verify %s
+// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s
-// lookup_left.h: expected-note{{using}}
-// lookup_right.h: expected-note{{also found}}
@import lookup_left_objc;
@import lookup_right_objc;
void test(id x) {
- [x method]; // expected-warning{{multiple methods named 'method' found}}
+ [x method];
+// expected-warning@-1{{multiple methods named 'method' found}}
+// expected-note@Inputs/lookup_left.h:2{{using}}
+// expected-note@Inputs/lookup_right.h:3{{also found}}
}
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -verify %s
-// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s
-
// CHECK-PRINT: - (int) method;
// CHECK-PRINT: - (double) method
// CHECK-PRINT: void test(id x)
diff --git a/test/Modules/macros.c b/test/Modules/macros.c
index 406e554a7a..433e03324b 100644
--- a/test/Modules/macros.c
+++ b/test/Modules/macros.c
@@ -1,4 +1,3 @@
-// XFAIL: *
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_top %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_left %S/Inputs/module.map
@@ -9,13 +8,13 @@
// FIXME: When we have a syntax for modules in C, use that.
// These notes come from headers in modules, and are bogus.
-// FIXME: expected-note{{previous definition is here}}
-// expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
-// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}}
-// FIXME: expected-note{{previous definition is here}} \
-// expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
-
-// expected-note{{other definition of 'TOP_RIGHT_REDEF'}}
+// FIXME: expected-note@Inputs/macros_left.h:11{{previous definition is here}}
+// FIXME: expected-note@Inputs/macros_right.h:12{{previous definition is here}}
+// expected-note@Inputs/macros_right.h:12{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note@Inputs/macros_top.h:13{{other definition of 'TOP_RIGHT_REDEF'}}
+// expected-note@Inputs/macros_right.h:13{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}}
+// expected-note@Inputs/macros_left.h:14{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note@Inputs/macros_right.h:17{{expanding this definition of 'TOP_RIGHT_REDEF'}}
@import macros;
@@ -80,8 +79,8 @@ void f() {
# error TOP should be visible
#endif
-#ifdef TOP_LEFT_UNDEF
-# error TOP_LEFT_UNDEF should not be visible
+#ifndef TOP_LEFT_UNDEF
+# error TOP_LEFT_UNDEF should still be defined
#endif
void test1() {
@@ -89,7 +88,8 @@ void test1() {
TOP_RIGHT_REDEF *ip = &i;
}
-#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}}
+#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}} \
+ // expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT2'}}
// Import right module (which also imports top)
@import macros_right;
@@ -112,11 +112,11 @@ void test2() {
int i;
float f;
double d;
- TOP_RIGHT_REDEF *ip = &i; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}}
+ TOP_RIGHT_REDEF *fp = &f; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}}
- LEFT_RIGHT_IDENTICAL *ip2 = &i;
- LEFT_RIGHT_DIFFERENT *fp = &f; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}}
- LEFT_RIGHT_DIFFERENT2 *dp = &d;
+ LEFT_RIGHT_IDENTICAL *ip = &i;
+ LEFT_RIGHT_DIFFERENT *ip2 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}}
+ LEFT_RIGHT_DIFFERENT2 *ip3 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT2}}
int LEFT_RIGHT_DIFFERENT3;
}
@@ -125,6 +125,7 @@ void test2() {
void test3() {
double d;
LEFT_RIGHT_DIFFERENT *dp = &d; // okay
+ int x = FN_ADD(1,2);
}
#ifndef TOP_RIGHT_UNDEF
@@ -133,6 +134,6 @@ void test3() {
@import macros_right.undef;
-#ifdef TOP_RIGHT_UNDEF
-# error TOP_RIGHT_UNDEF should not be defined
+#ifndef TOP_RIGHT_UNDEF
+# error TOP_RIGHT_UNDEF should still be defined
#endif
diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m
index 9a8897b383..6fd74b0885 100644
--- a/test/Modules/method_pool.m
+++ b/test/Modules/method_pool.m
@@ -8,8 +8,8 @@
- (void)method5:(D*)obj;
@end
-// in other file: // expected-note@7{{using}}
-// in other file: expected-note@12{{also found}}
+// expected-note@Inputs/MethodPoolA.h:7{{using}}
+// expected-note@Inputs/MethodPoolB.h:12{{also found}}
void testMethod1(id object) {
[object method1];
@@ -51,8 +51,8 @@ void testMethod3Again(id object) {
void testMethod3AgainAgain(id object) {
[object method3]; // expected-warning{{multiple methods named 'method3' found}}
- // expected-note@2{{using}}
- // expected-note@2{{also found}}
+ // expected-note@Inputs/MethodPoolBSub.h:2{{using}}
+ // expected-note@Inputs/MethodPoolASub.h:2{{also found}}
}
void testMethod4Again(id object) {
diff --git a/test/Modules/modify-module.m b/test/Modules/modify-module.m
index 7433e6f7a2..953c917cdd 100644
--- a/test/Modules/modify-module.m
+++ b/test/Modules/modify-module.m
@@ -6,17 +6,22 @@
// RUN: cp %S/Inputs/Modified/A.h %t/include
// RUN: cp %S/Inputs/Modified/B.h %t/include
// RUN: cp %S/Inputs/Modified/module.map %t/include
-// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
-// expected-no-diagnostics
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
// RUN: echo '' >> %t/include/B.h
-// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
// RUN: echo 'int getA(); int getA2();' > %t/include/A.h
-// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
+// RUN: rm %t/cache/ModA.pcm
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
+// RUN: touch %t/cache/ModA.pcm
+// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify
+
+// expected-no-diagnostics
// FIXME: It is intended to suppress this on win32.
// REQUIRES: ansi-escape-sequences
-@import B;
+@import ModB;
int getValue() { return getA() + getB(); }
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index d4e73b5396..438dcab984 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -15,7 +15,7 @@ int test_broken() {
HiddenStruct hidden; // \
// expected-error{{must use 'struct' tag to refer to type 'HiddenStruct' in this scope}} \
// expected-error{{definition of 'struct HiddenStruct' must be imported}}
- // expected-note@3 {{previous definition is here}}
+ // expected-note@Inputs/module_private_left.h:3 {{previous definition is here}}
Integer i; // expected-error{{unknown type name 'Integer'}}
diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m
new file mode 100644
index 0000000000..09319d60fe
--- /dev/null
+++ b/test/Modules/module_file_info.m
@@ -0,0 +1,34 @@
+
+@import DependsOnModule;
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -w -fmodules -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE %s
+// RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s
+
+// CHECK: Generated by this Clang:
+
+// CHECK: Language options:
+// CHECK: C99: Yes
+// CHECK: Objective-C 1: Yes
+// CHECK: modules extension to C: Yes
+
+// CHECK: Target options:
+// CHECK: Triple:
+// CHECK: CPU:
+// CHECK: ABI:
+// CHECK: C++ ABI:
+// CHECK: Linker version:
+
+// CHECK: Header search options:
+// CHECK: System root [-isysroot=]: '/'
+// CHECK: Use builtin include directories [-nobuiltininc]: Yes
+// CHECK: Use standard system include directories [-nostdinc]: Yes
+// CHECK: Use standard C++ include directories [-nostdinc++]: Yes
+// CHECK: Use libc++ (rather than libstdc++) [-stdlib=]:
+
+// CHECK: Preprocessor options:
+// CHECK: Uses compiler/target-specific predefines [-undef]: Yes
+// CHECK: Uses detailed preprocessing record (for indexing): No
+// CHECK: Predefined macros:
+// CHECK: -DBLARG
+// CHECK: -DWIBBLE=WOBBLE
diff --git a/test/Modules/namespaces.cpp b/test/Modules/namespaces.cpp
index 0e9dbffcbb..426e0025f9 100644
--- a/test/Modules/namespaces.cpp
+++ b/test/Modules/namespaces.cpp
@@ -73,5 +73,5 @@ void testAnonymousNotMerged() {
N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::<anonymous>::Foo *' with an rvalue of type 'N12::<anonymous>::Foo *'}}
}
-// namespaces-right.h: expected-note@60 {{passing argument to parameter here}}
-// namespaces-right.h: expected-note@67 {{passing argument to parameter here}}
+// expected-note@Inputs/namespaces-right.h:60 {{passing argument to parameter here}}
+// expected-note@Inputs/namespaces-right.h:67 {{passing argument to parameter here}}
diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp
index 423e808bca..8155318fb3 100644
--- a/test/Modules/normal-module-map.cpp
+++ b/test/Modules/normal-module-map.cpp
@@ -1,5 +1,3 @@
-// Note: inside the module. expected-note{{'nested_umbrella_a' declared here}}
-
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/normal-module-map %s -verify
#include "Umbrella/umbrella_sub.h"
@@ -25,7 +23,9 @@ int testNestedUmbrellaA() {
}
int testNestedUmbrellaBFail() {
- return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
+ return nested_umbrella_b;
+ // expected-error@-1{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
+ // expected-note@Inputs/normal-module-map/nested_umbrella/a.h:1{{'nested_umbrella_a' declared here}}
}
@import nested_umbrella.b;
diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m
index d3ebcb7527..81fb28bafb 100644
--- a/test/Modules/objc-categories.m
+++ b/test/Modules/objc-categories.m
@@ -8,11 +8,8 @@
@import category_bottom;
-
-
-
-// in category_left.h: expected-note {{previous definition}}
-// in category_right.h: expected-warning@11 {{duplicate definition of category}}
+// expected-note@Inputs/category_left.h:14 {{previous definition}}
+// expected-warning@Inputs/category_right.h:11 {{duplicate definition of category}}
@interface Foo(Source)
-(void)source;
@@ -75,7 +72,7 @@ void test_hidden_right_errors(Foo *foo) {
[p4 p4_method]; // expected-warning{{instance method '-p4_method' not found (return type defaults to 'id')}}
id p4p = p4.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'id<P4>'}}
p4p = foo.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'Foo *'; did you mean 'p3_prop'?}}
- // expected-note@7{{'p3_prop' declared here}}
+ // expected-note@Inputs/category_left_sub.h:7{{'p3_prop' declared here}}
}
@import category_right.sub;
diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m
index 31742f7e03..e958759420 100644
--- a/test/Modules/on-demand-build.m
+++ b/test/Modules/on-demand-build.m
@@ -7,7 +7,7 @@
@interface OtherClass
@end
-// in module: expected-note@17{{class method 'alloc' is assumed to return an instance of its receiver type ('Module *')}}
+// expected-note@Inputs/Module.framework/Headers/Module.h:17{{class method 'alloc' is assumed to return an instance of its receiver type ('Module *')}}
void test_getModuleVersion() {
const char *version = getModuleVersion();
const char *version2 = [Module version];
diff --git a/test/Modules/prune.m b/test/Modules/prune.m
new file mode 100644
index 0000000000..8af7e6c395
--- /dev/null
+++ b/test/Modules/prune.m
@@ -0,0 +1,46 @@
+// Test the automatic pruning of module cache entries.
+#ifdef IMPORT_DEPENDS_ON_MODULE
+@import DependsOnModule;
+#else
+@import Module;
+#endif
+
+// We need 'touch' and 'find' for this test to work.
+// REQUIRES: shell
+
+// Clear out the module cache
+// RUN: rm -rf %t
+// Run Clang twice so we end up creating the timestamp file (the second time).
+// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify
+// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify
+// RUN: ls %t | grep modules.timestamp
+// RUN: ls -R %t | grep ^Module.pcm
+// RUN: ls -R %t | grep DependsOnModule.pcm
+
+// Set the timestamp back more than two days. We should try to prune,
+// but nothing gets pruned because the module files are new enough.
+// RUN: touch -m -a -t 201101010000 %t/modules.timestamp
+// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
+// RUN: ls %t | grep modules.timestamp
+// RUN: ls -R %t | grep ^Module.pcm
+// RUN: ls -R %t | grep DependsOnModule.pcm
+
+// Set the DependsOnModule access time back more than four days.
+// This shouldn't prune anything, because the timestamp has been updated, so
+// the pruning mechanism won't fire.
+// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000
+// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
+// RUN: ls %t | grep modules.timestamp
+// RUN: ls -R %t | grep ^Module.pcm
+// RUN: ls -R %t | grep DependsOnModule.pcm
+
+// Set both timestamp and DependsOnModule.pcm back beyond the cutoff.
+// This should trigger pruning, which will remove DependsOnModule but not Module.
+// RUN: touch -m -a -t 201101010000 %t/modules.timestamp
+// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000
+// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
+// RUN: ls %t | grep modules.timestamp
+// RUN: ls -R %t | grep ^Module.pcm
+// RUN: ls -R %t | not grep DependsOnModule.pcm
+
+// expected-no-diagnostics
diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m
index e37366748d..37e5967f4e 100644
--- a/test/Modules/redecl-merge.m
+++ b/test/Modules/redecl-merge.m
@@ -27,8 +27,8 @@ int *call_eventually_noreturn_again(void) {
int *call_eventually_noreturn2_again(void) {
// noreturn and non-noreturn functions have different types
eventually_noreturn2(); // expected-error{{call to 'eventually_noreturn2' is ambiguous}}
- // expected-note@93{{candidate function}}
- // expected-note@90{{candidate function}}
+ // expected-note@Inputs/redecl-merge-left.h:93{{candidate function}}
+ // expected-note@Inputs/redecl-merge-right.h:90{{candidate function}}
}
@implementation A
@@ -79,24 +79,26 @@ void testTypedefMerge(int i, double d) {
T1 *ip = &i;
// FIXME: Typedefs aren't actually merged in the sense of other merges, because
// we should only merge them when the types are identical.
- // in other file: expected-note@60{{candidate found by name lookup is 'T2'}}
- // in other file: expected-note@63{{candidate found by name lookup is 'T2'}}
+ // expected-note@Inputs/redecl-merge-left.h:60{{candidate found by name lookup is 'T2'}}
+ // expected-note@Inputs/redecl-merge-right.h:63{{candidate found by name lookup is 'T2'}}
T2 *dp = &d; // expected-error{{reference to 'T2' is ambiguous}}
}
void testFuncMerge(int i) {
func0(i);
func1(i);
- // in other file: expected-note@64{{candidate function}}
- // in other file: expected-note@70{{candidate function}}
+ // expected-note@Inputs/redecl-merge-left.h:64{{candidate function}}
+ // expected-note@Inputs/redecl-merge-right.h:70{{candidate function}}
func2(i); // expected-error{{call to 'func2' is ambiguous}}
}
void testVarMerge(int i) {
var1 = i;
- // in other files: expected-note@77 2{{candidate found by name lookup is 'var2'}}
+ // expected-note@Inputs/redecl-merge-left.h:77{{candidate found by name lookup is 'var2'}}
+ // expected-note@Inputs/redecl-merge-right.h:77{{candidate found by name lookup is 'var2'}}
var2 = i; // expected-error{{reference to 'var2' is ambiguous}}
- // in other files: expected-note@79 2{{candidate found by name lookup is 'var3'}}
+ // expected-note@Inputs/redecl-merge-left.h:79{{candidate found by name lookup is 'var3'}}
+ // expected-note@Inputs/redecl-merge-right.h:79{{candidate found by name lookup is 'var3'}}
var3 = i; // expected-error{{reference to 'var3' is ambiguous}}
}
diff --git a/test/Modules/redecls/a.h b/test/Modules/redecls/a.h
new file mode 100644
index 0000000000..1647f86606
--- /dev/null
+++ b/test/Modules/redecls/a.h
@@ -0,0 +1,3 @@
+@interface AA
+@end
+@class AA;
diff --git a/test/Modules/redecls/b.h b/test/Modules/redecls/b.h
new file mode 100644
index 0000000000..d41573ddc7
--- /dev/null
+++ b/test/Modules/redecls/b.h
@@ -0,0 +1 @@
+@class AA;
diff --git a/test/Modules/redecls/main.m b/test/Modules/redecls/main.m
new file mode 100644
index 0000000000..9ec02b03f2
--- /dev/null
+++ b/test/Modules/redecls/main.m
@@ -0,0 +1,27 @@
+// RUN: rm -rf %t.mcp
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-name=a %S/module.map -fmodules-cache-path=%t.mcp
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-name=b %S/module.map -fmodules-cache-path=%t.mcp
+// RUN: %clang_cc1 -fmodules %s -emit-pch -o %t1.pch -fmodules-cache-path=%t.mcp
+// RUN: %clang_cc1 -fmodules %s -emit-pch -o %t2.pch -include-pch %t1.pch -fmodules-cache-path=%t.mcp
+// RUN: %clang_cc1 -fmodules %s -fsyntax-only -include-pch %t2.pch -fmodules-cache-path=%t.mcp -verify
+
+#ifndef HEADER1
+#define HEADER1
+
+@import a;
+
+#elif !defined(HEADER2)
+#define HEADER2
+
+@class AA;
+@import b;
+
+#else
+
+// rdar://13712705
+@interface SS : AA
+@end
+
+#warning parsed this
+#endif
+// expected-warning@-2{{parsed this}}
diff --git a/test/Modules/redecls/module.map b/test/Modules/redecls/module.map
new file mode 100644
index 0000000000..a36568207b
--- /dev/null
+++ b/test/Modules/redecls/module.map
@@ -0,0 +1,2 @@
+module a { header "a.h" }
+module b { header "b.h" }
diff --git a/test/Modules/renamed.m b/test/Modules/renamed.m
new file mode 100644
index 0000000000..4e8f5329bb
--- /dev/null
+++ b/test/Modules/renamed.m
@@ -0,0 +1,8 @@
+@import NewName;
+
+int f() { return same_api; }
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -I %S/Inputs -fmodules-cache-path=%t %s -verify
+
+// expected-no-diagnostics
diff --git a/test/Modules/serialized-diags.m b/test/Modules/serialized-diags.m
new file mode 100644
index 0000000000..18bce06047
--- /dev/null
+++ b/test/Modules/serialized-diags.m
@@ -0,0 +1,32 @@
+@import HasWarnings;
+
+#ifdef WITH_ERRORS
+@import HasErrors;
+#endif
+
+float float_val;
+double *double_ptr = &float_val;
+
+// RUN: rm -rf %t %t.diag %t.out
+// RUN: %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only %s --serialize-diagnostics %t.diag > /dev/null 2>&1
+// RUN: c-index-test -read-diagnostics %t.diag > %t.out 2>&1
+// RUN: FileCheck --input-file=%t.out %s
+
+// CHECK: has_warnings.h:3:8: warning: incompatible pointer types initializing 'float *'
+// CHECK: serialized-diags.m:1:9: note: while building module 'HasWarnings' imported from
+// CHECK: serialized-diags.m:8:9: warning: incompatible pointer types initializing 'double *'
+// CHECK: Number of diagnostics: 2
+
+// RUN: rm -rf %t %t.diag_errors %t.out_errors
+// RUN: not %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only -DWITH_ERRORS %s --serialize-diagnostics %t.diag_errors > /dev/null 2>&1
+// RUN: c-index-test -read-diagnostics %t.diag_errors > %t.out_errors 2>&1
+// RUN: FileCheck -check-prefix=CHECK-WITH-ERRORS --input-file=%t.out_errors %s
+
+// CHECK-WITH-ERRORS: has_warnings.h:3:8: warning: incompatible pointer types initializing 'float *'
+// CHECK-WITH-ERRORS: serialized-diags.m:1:9: note: while building module 'HasWarnings'
+// CHECK-WITH-ERRORS: has_errors.h:2:13: error: redefinition of 'foo'
+// CHECK-WITH-ERRORS: serialized-diags.m:4:9: note: while building module 'HasErrors'
+// CHECK-WITH-ERRORS: has_errors.h:1:13: note: previous definition is here
+// CHECK-WITH-ERRORS: serialized-diags.m:4:9: fatal: could not build module 'HasErrors'
+// CHECK-WITH-ERRORS: Number of diagnostics: 3
+
diff --git a/test/Modules/stddef.m b/test/Modules/stddef.m
new file mode 100644
index 0000000000..83f73f9d33
--- /dev/null
+++ b/test/Modules/stddef.m
@@ -0,0 +1,7 @@
+@import StdDef.Other;
+
+size_t getSize();
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/StdDef %s -verify
+// expected-no-diagnostics
diff --git a/test/Modules/subframeworks.m b/test/Modules/subframeworks.m
index 22dfcca365..ad70cc2b22 100644
--- a/test/Modules/subframeworks.m
+++ b/test/Modules/subframeworks.m
@@ -23,7 +23,7 @@ CXXOnly cxxonly;
@import HasSubModules;
-// expected-warning@1{{treating #include as an import of module 'HasSubModules.Sub.Types'}}
+// expected-warning@Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h:1{{treating #include as an import of module 'HasSubModules.Sub.Types'}}
#import <HasSubModules/HasSubModulesPriv.h>
struct FrameworkSubStruct ss;
diff --git a/test/Modules/system_version.m b/test/Modules/system_version.m
new file mode 100644
index 0000000000..85b3263f72
--- /dev/null
+++ b/test/Modules/system_version.m
@@ -0,0 +1,32 @@
+// Test checking that we're hashing a system version file in the
+// module hash.
+// REQUIRES: shell
+
+// First, build a system root.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/usr/include
+// RUN: cp %S/Inputs/Modified/A.h %t/usr/include
+// RUN: cp %S/Inputs/Modified/B.h %t/usr/include
+// RUN: cp %S/Inputs/Modified/module.map %t/usr/include
+
+// Run once with no system version file. We should end up with one module.
+// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
+// RUN: ls -R %t | grep -c ModA.pcm| grep 1
+
+// Add a system version file and run again. We should now have two
+// module variants.
+// RUN: mkdir -p %t/System/Library/CoreServices
+// RUN: echo "hello" > %t/System/Library/CoreServices/SystemVersion.plist
+// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
+// RUN: ls -R %t | grep -c ModA.pcm| grep 2
+
+// Change the system version file and run again. We should now have three
+// module variants.
+// RUN: mkdir -p %t/System/Library/CoreServices
+// RUN: echo "modules" > %t/System/Library/CoreServices/SystemVersion.plist
+// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
+// RUN: ls -R %t | grep -c ModA.pcm| grep 3
+
+// expected-no-diagnostics
+@import ModA;
+