summaryrefslogtreecommitdiff
path: root/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
commitb2a28ae96553a9fcebc6fa7b32238bce6b45d4ff (patch)
treed4e11a582fd11ef03fb90cb770c086878dfea875 /test/Modules/explicit-build-flags.cpp
parent5604db48b054dd95f35d0796a2616377d2090957 (diff)
downloadclang-b2a28ae96553a9fcebc6fa7b32238bce6b45d4ff.tar.gz
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/explicit-build-flags.cpp')
-rw-r--r--test/Modules/explicit-build-flags.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Modules/explicit-build-flags.cpp b/test/Modules/explicit-build-flags.cpp
new file mode 100644
index 0000000000..67da617664
--- /dev/null
+++ b/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