summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2014-03-19 10:22:36 +0000
committerManuel Klimek <klimek@google.com>2014-03-19 10:22:36 +0000
commit98a9a6c6674f0a2aded55a89f6b6d0ef52ab145d (patch)
tree5cc29e021e140238c73c3bb4601782a61febae6d /clang/test
parent8e6829e4369832185333a2ce33f599989309b203 (diff)
downloadbcm5719-llvm-98a9a6c6674f0a2aded55a89f6b6d0ef52ab145d.tar.gz
bcm5719-llvm-98a9a6c6674f0a2aded55a89f6b6d0ef52ab145d.zip
Use the expansion location of the file name when finding the module.
The spelling location of stringified strings is not a file location. Optimally, we'll want to solve the problem (as the FIXME states) by handing in the right FileEntry of the #include location. llvm-svn: 204220
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/declare-use/j.h14
-rw-r--r--clang/test/Modules/Inputs/declare-use/module.map5
-rw-r--r--clang/test/Modules/declare-use3.cpp4
-rw-r--r--clang/test/Modules/declare-use4.cpp10
4 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/declare-use/j.h b/clang/test/Modules/Inputs/declare-use/j.h
new file mode 100644
index 00000000000..04d46a9fb2b
--- /dev/null
+++ b/clang/test/Modules/Inputs/declare-use/j.h
@@ -0,0 +1,14 @@
+#ifndef J_H
+#define J_H
+
+#define STR(x) #x
+#define HDR(x) STR(x.h)
+
+#include ALLOWED_INC
+#include HDR(a)
+
+const int j = a * a + b;
+
+// expected-no-diagnostics
+
+#endif
diff --git a/clang/test/Modules/Inputs/declare-use/module.map b/clang/test/Modules/Inputs/declare-use/module.map
index 3b1b0e743e4..a176fb3a141 100644
--- a/clang/test/Modules/Inputs/declare-use/module.map
+++ b/clang/test/Modules/Inputs/declare-use/module.map
@@ -37,6 +37,7 @@ module XG {
header "g1.h"
use XC
use XE
+ use XJ
}
module XH {
@@ -47,5 +48,9 @@ module XH {
use XE
}
+module XJ {
+ header "j.h"
+}
+
module XS {
}
diff --git a/clang/test/Modules/declare-use3.cpp b/clang/test/Modules/declare-use3.cpp
new file mode 100644
index 00000000000..8b0bbfa756c
--- /dev/null
+++ b/clang/test/Modules/declare-use3.cpp
@@ -0,0 +1,4 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -include "g.h" -include "e.h" -include "f.h" -include "i.h" -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify
+// expected-error {{module XG does not depend on a module exporting 'f.h'}}
+const int g2 = g1 + e + f + aux_i;
diff --git a/clang/test/Modules/declare-use4.cpp b/clang/test/Modules/declare-use4.cpp
new file mode 100644
index 00000000000..1d346469f1e
--- /dev/null
+++ b/clang/test/Modules/declare-use4.cpp
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify
+
+#define ALLOWED_INC "b.h"
+
+#include "j.h"
+
+const int g2 = j;
+
+// expected-no-diagnostics
OpenPOWER on IntegriCloud