summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/explicit-build-flags.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-10-28 16:24:08 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-10-28 16:24:08 +0000
commit96fdab6eb59ae6ceda45657491564e7f97969175 (patch)
tree1ca9963d719ced0b9a3354cb3b65d3825b301190 /clang/test/Modules/explicit-build-flags.cpp
parent784c3f0d6e9fd817a762cc4c433b8ecefb64280d (diff)
downloadbcm5719-llvm-96fdab6eb59ae6ceda45657491564e7f97969175.tar.gz
bcm5719-llvm-96fdab6eb59ae6ceda45657491564e7f97969175.zip
[modules] Allow -I, -D, -W flags to change between building a module and
explicitly using the resulting .pcm file. Unlike for an implicit module build, we don't need nor want to require these flags to match between the module and its users. llvm-svn: 220780
Diffstat (limited to 'clang/test/Modules/explicit-build-flags.cpp')
-rw-r--r--clang/test/Modules/explicit-build-flags.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Modules/explicit-build-flags.cpp b/clang/test/Modules/explicit-build-flags.cpp
new file mode 100644
index 00000000000..67da617664b
--- /dev/null
+++ b/clang/test/Modules/explicit-build-flags.cpp
@@ -0,0 +1,27 @@
+// REQUIRES: shell
+
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo 'module tmp { header "tmp.h" }' > %t/map
+// RUN: touch %t/tmp.h
+// RUN: %clang_cc1 -fmodules -DFOO=1 -x c++ -fmodule-name=tmp %t/map -emit-module -o %t/tmp.pcm
+
+// Can use the module.
+// RUN: %clang_cc1 -fmodules -DFOO=1 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
+// Can use the module if an input file is newer. (This happens on
+// remote file systems.)
+// RUN: sleep 1
+// RUN: touch %t/tmp.h
+// RUN: %clang_cc1 -fmodules -DFOO=1 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
+// Can use the module if -D flags change.
+// RUN: %clang_cc1 -fmodules -DFOO=2 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
+// Can use the module if -W flags change.
+// RUN: %clang_cc1 -fmodules -Wextra -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
+// Can use the module if -I flags change.
+// RUN: %clang_cc1 -fmodules -I. -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
+#include "tmp.h" // expected-no-diagnostics
OpenPOWER on IntegriCloud