summaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-20 21:20:51 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-20 21:20:51 +0000
commit583e75cce441388bc562fa225d23499261a0091e (patch)
tree5944a7c248d4a8c858db45abc3444eb69270a3c8 /test/Modules
parent7442d6faa2719e4e7d33a7021c406c5a4facd74d (diff)
Notes
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/odr_hash.cpp191
-rw-r--r--test/Modules/umbrella-header-include-builtin.mm8
2 files changed, 75 insertions, 124 deletions
diff --git a/test/Modules/odr_hash.cpp b/test/Modules/odr_hash.cpp
index 75436706200c5..2ec8005ce509e 100644
--- a/test/Modules/odr_hash.cpp
+++ b/test/Modules/odr_hash.cpp
@@ -526,138 +526,51 @@ S3 s3;
// Interesting cases that should not cause errors. struct S should not error
// while struct T should error at the access specifier mismatch at the end.
namespace AllDecls {
-#if defined(FIRST)
-typedef int INT;
-struct S {
- public:
- private:
- protected:
-
- static_assert(1 == 1, "Message");
- static_assert(2 == 2);
-
- int x;
- double y;
-
- INT z;
-
- unsigned a : 1;
- unsigned b : 2*2 + 5/2;
-
- mutable int c = sizeof(x + y);
-
- void method() {}
- static void static_method() {}
- virtual void virtual_method() {}
- virtual void pure_virtual_method() = 0;
- inline void inline_method() {}
- void volatile_method() volatile {}
- void const_method() const {}
+#define CREATE_ALL_DECL_STRUCT(NAME, ACCESS) \
+ typedef int INT; \
+ struct NAME { \
+ public: \
+ private: \
+ protected: \
+ static_assert(1 == 1, "Message"); \
+ static_assert(2 == 2); \
+ \
+ int x; \
+ double y; \
+ \
+ INT z; \
+ \
+ unsigned a : 1; \
+ unsigned b : 2 * 2 + 5 / 2; \
+ \
+ mutable int c = sizeof(x + y); \
+ \
+ void method() {} \
+ static void static_method() {} \
+ virtual void virtual_method() {} \
+ virtual void pure_virtual_method() = 0; \
+ inline void inline_method() {} \
+ void volatile_method() volatile {} \
+ void const_method() const {} \
+ \
+ typedef int typedef_int; \
+ using using_int = int; \
+ \
+ ACCESS: \
+ };
- typedef int typedef_int;
- using using_int = int;
-};
+#if defined(FIRST)
+CREATE_ALL_DECL_STRUCT(S, public)
#elif defined(SECOND)
-typedef int INT;
-struct S {
- public:
- private:
- protected:
-
- static_assert(1 == 1, "Message");
- static_assert(2 == 2);
-
- int x;
- double y;
-
- INT z;
-
- unsigned a : 1;
- unsigned b : 2 * 2 + 5 / 2;
-
- mutable int c = sizeof(x + y);
-
- void method() {}
- static void static_method() {}
- virtual void virtual_method() {}
- virtual void pure_virtual_method() = 0;
- inline void inline_method() {}
- void volatile_method() volatile {}
- void const_method() const {}
-
- typedef int typedef_int;
- using using_int = int;
-};
+CREATE_ALL_DECL_STRUCT(S, public)
#else
S *s;
#endif
#if defined(FIRST)
-typedef int INT;
-struct T {
- public:
- private:
- protected:
-
- static_assert(1 == 1, "Message");
- static_assert(2 == 2);
-
- int x;
- double y;
-
- INT z;
-
- unsigned a : 1;
- unsigned b : 2 * 2 + 5 / 2;
-
- mutable int c = sizeof(x + y);
-
- void method() {}
- static void static_method() {}
- virtual void virtual_method() {}
- virtual void pure_virtual_method() = 0;
- inline void inline_method() {}
- void volatile_method() volatile {}
- void const_method() const {}
-
- typedef int typedef_int;
- using using_int = int;
-
- private:
-};
+CREATE_ALL_DECL_STRUCT(T, private)
#elif defined(SECOND)
-typedef int INT;
-struct T {
- public:
- private:
- protected:
-
- static_assert(1 == 1, "Message");
- static_assert(2 == 2);
-
- int x;
- double y;
-
- INT z;
-
- unsigned a : 1;
- unsigned b : 2 * 2 + 5 / 2;
-
- mutable int c = sizeof(x + y);
-
- void method() {}
- static void static_method() {}
- virtual void virtual_method() {}
- virtual void pure_virtual_method() = 0;
- inline void inline_method() {}
- void volatile_method() volatile {}
- void const_method() const {}
-
- typedef int typedef_int;
- using using_int = int;
-
- public:
-};
+CREATE_ALL_DECL_STRUCT(T, public)
#else
T *t;
// expected-error@second.h:* {{'AllDecls::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
@@ -944,6 +857,36 @@ T t;
#endif
} // namespace StructWithForwardDeclarationNoDefinition
+namespace LateParsedDefaultArgument {
+#if defined(FIRST)
+template <typename T>
+struct S {
+ struct R {
+ void foo(T x = 0) {}
+ };
+};
+#elif defined(SECOND)
+#else
+void run() {
+ S<int>::R().foo();
+}
+#endif
+}
+
+namespace LateParsedDefaultArgument {
+#if defined(FIRST)
+template <typename alpha> struct Bravo {
+ void charlie(bool delta = false) {}
+};
+typedef Bravo<char> echo;
+echo foxtrot;
+
+Bravo<char> golf;
+#elif defined(SECOND)
+#else
+#endif
+}
+
// Keep macros contained to one file.
#ifdef FIRST
#undef FIRST
diff --git a/test/Modules/umbrella-header-include-builtin.mm b/test/Modules/umbrella-header-include-builtin.mm
index 75b9c905ff001..da21779683cf7 100644
--- a/test/Modules/umbrella-header-include-builtin.mm
+++ b/test/Modules/umbrella-header-include-builtin.mm
@@ -4,3 +4,11 @@
// RUN: %clang -cc1 -fsyntax-only -nostdinc++ -isysroot %S/Inputs/libc-libcxx/sysroot -isystem %S/Inputs/libc-libcxx/sysroot/usr/include/c++/v1 -F%S/Inputs/libc-libcxx/sysroot/Frameworks -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c++ %s
#include <A/A.h>
+
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo "module NonExistent1 { umbrella \"NonExistent\" }" > %t/modules.modulemap
+// RUN: echo "" > %t/A.h
+// RUN: echo "#include \"A.h\" int i;" > %t/T.cxx
+// RUN: %clang -I %t -fmodules -fsyntax-only %t/T.cxx
+// expected-warning {{ umbrella directory }}