diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /test/Modules/explicit-build-flags.cpp | |
parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) |
Notes
Diffstat (limited to 'test/Modules/explicit-build-flags.cpp')
-rw-r--r-- | test/Modules/explicit-build-flags.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/Modules/explicit-build-flags.cpp b/test/Modules/explicit-build-flags.cpp new file mode 100644 index 000000000000..6ced215a06d1 --- /dev/null +++ b/test/Modules/explicit-build-flags.cpp @@ -0,0 +1,49 @@ +// 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 -DBAR=1 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DBAR=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 -DBAR=2 -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 -DBAR=2 -I. -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s + +// Can use the module if -O flags change. +// RUN: %clang_cc1 -fmodules -DBAR=2 -Os -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// +// RUN: %clang_cc1 -fmodules -DFOO=1 -O2 -x c++ -fmodule-name=tmp %t/map -emit-module -o %t/tmp-O2.pcm +// RUN: %clang_cc1 -fmodules -DBAR=2 -O0 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp-O2.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DBAR=2 -Os -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp-O2.pcm -verify -I%t %s + +#include "tmp.h" // expected-no-diagnostics + +#ifndef BAR +#if FOO != 1 +#error bad FOO from command line and module +#endif +#elif BAR == 1 +#if FOO != 2 +#error bad FOO from command line overriding module +#endif +#elif BAR == 2 +#ifdef FOO +#error FOO leaked from module +#endif +#else +#error bad BAR +#endif |