summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2015-06-23 18:20:18 +0000
committerBen Langmuir <blangmuir@apple.com>2015-06-23 18:20:18 +0000
commitcd98cb731288722bf44204feb2f570caaec6617c (patch)
treeb479486484ae89a997628da14f56b261d048be68 /clang/test/Modules
parentc78c2bcb2a005266d7c6982ed57accd394028153 (diff)
downloadbcm5719-llvm-cd98cb731288722bf44204feb2f570caaec6617c.tar.gz
bcm5719-llvm-cd98cb731288722bf44204feb2f570caaec6617c.zip
[Modules] Consider -fmodule-feature in module hash and when loading
Any extra features from -fmodule-feature are part of the module hash and need to get validated on load. Also print them with -module-file-info. llvm-svn: 240433
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/module-feature.m14
-rw-r--r--clang/test/Modules/module_file_info.m4
2 files changed, 17 insertions, 1 deletions
diff --git a/clang/test/Modules/module-feature.m b/clang/test/Modules/module-feature.m
new file mode 100644
index 00000000000..4926d26515f
--- /dev/null
+++ b/clang/test/Modules/module-feature.m
@@ -0,0 +1,14 @@
+// RUN: rm -rf %t %t.nohash
+
+// Each set of features gets its own cache.
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -fmodule-feature f1 -F %S/Inputs %s -Rmodule-build 2>&1 | FileCheck %s -allow-empty -check-prefix=ALREADY_BUILT
+// ALREADY_BUILT-NOT: building module
+
+// Errors if we try to force the load.
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f2 -F %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DIFFERS
+// DIFFERS: error: module features differs
+
+@import Module; // expected-remark {{building module 'Module'}} expected-remark {{finished}}
diff --git a/clang/test/Modules/module_file_info.m b/clang/test/Modules/module_file_info.m
index 01d5073650b..8693d2b8949 100644
--- a/clang/test/Modules/module_file_info.m
+++ b/clang/test/Modules/module_file_info.m
@@ -2,7 +2,7 @@
@import DependsOnModule;
// RUN: rm -rf %t
-// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE %s
+// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s
// RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s
// CHECK: Generated by this Clang:
@@ -14,6 +14,8 @@
// CHECK: C99: Yes
// CHECK: Objective-C 1: Yes
// CHECK: modules extension to C: Yes
+// CHECK: Module features:
+// CHECK: myfeature
// CHECK: Target options:
// CHECK: Triple:
OpenPOWER on IntegriCloud