aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-05-02 17:58:30 +0000
committerDouglas Gregor <dgregor@apple.com>2013-05-02 17:58:30 +0000
commitdb3910be2e30b3fa00474f0e1c0780f544469dee (patch)
treed7d55d20fae825b53544f132dfd991779362d659 /test
parent82e3b47276f175a4b51772525da5314f0f48df9c (diff)
When looking for the module associated with one of our magical builtin headers, speculatively load module maps.
The "magical" builtin headers are the headers we provide as part of the C standard library, which typically comes from /usr/include. We essentially merge our headers into that location (due to cyclic dependencies). This change makes sure that, when header search finds one of our builtin headers, we figure out which module it actually lives in. This case is fairly rare; one ends up having to include one of the few built-in C headers we provide before including anything from /usr/include to trigger it. Fixes <rdar://problem/13787184>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-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/cstd.m7
4 files changed, 19 insertions, 3 deletions
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/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
-
-