[modules] Additional tests.

llvm-svn: 293223
This commit is contained in:
Richard Smith
2017-01-26 23:07:59 +00:00
parent 7ea2929d84
commit 76ea19641e
14 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
struct X { union { int n; }; };
inline int a(X x) { return x.n; }

View File

@@ -0,0 +1,2 @@
struct X { union { int n; }; };
inline int b(X x) { return x.n; }

View File

@@ -0,0 +1,2 @@
#include "a.h"
#include "b.h"

View File

@@ -0,0 +1,2 @@
struct X { union { int n; }; };
inline int c(X x) { return x.n; }

View File

@@ -0,0 +1,6 @@
module a { header "a.h" }
module b { header "b.h" }
module c {
module c1 { header "c1.h" }
module c2 { header "c2.h" }
}

View File

@@ -0,0 +1,3 @@
namespace NS {
struct X {};
}

View File

@@ -0,0 +1,4 @@
module hidden {
header "visible.h"
explicit module sub { header "hidden.h" }
}

View File

@@ -0,0 +1,2 @@
// hidden-names/visible.h
namespace NS {}

View File

@@ -0,0 +1,4 @@
struct X {
virtual void f();
};
inline void X::f() {}

View File

@@ -0,0 +1,4 @@
module m {
module a { header "a.h" }
module b { header "b.h" }
}

View File

@@ -0,0 +1,15 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-local-submodule-visibility \
// RUN: -fmodule-map-file=%S/Inputs/anon-redecl/module.modulemap \
// RUN: -I%S/Inputs/anon-redecl \
// RUN: -verify -std=c++11 %s
#include "a.h"
#include "b.h"
#include "c1.h"
#include "c2.h"
// expected-no-diagnostics
int x = a({});
int y = b({});
int z = c({});

View File

@@ -0,0 +1,13 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/hidden-names %s -verify
// expected-no-diagnostics
#include "visible.h"
using namespace NS;
namespace {
struct X { void f(); };
}
void X::f() {}

View File

@@ -0,0 +1,11 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -I%S/Inputs/merge-function-defs -fmodules -fmodule-map-file=%S/Inputs/merge-function-defs/map -fmodules-cache-path=%t %s -emit-llvm-only
#include "b.h"
struct X {
virtual void f();
};
inline void X::f() {}
X x;