diff options
Diffstat (limited to 'clang/test/Modules')
6 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h new file mode 100644 index 00000000000..4c5cd949f23 --- /dev/null +++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/a.h @@ -0,0 +1 @@ +struct A {}; diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h new file mode 100644 index 00000000000..2b8f5f868ed --- /dev/null +++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/b.h @@ -0,0 +1,2 @@ +// Include definition of A into the same module as c.h +#include "a.h" diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h new file mode 100644 index 00000000000..27f503c2c60 --- /dev/null +++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/c.h @@ -0,0 +1 @@ +struct A; diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h b/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h new file mode 100644 index 00000000000..2243de1baf9 --- /dev/null +++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/d.h @@ -0,0 +1 @@ +#include "a.h" diff --git a/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap b/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap new file mode 100644 index 00000000000..7d988fbba00 --- /dev/null +++ b/clang/test/Modules/Inputs/merge-class-definition-visibility/modmap @@ -0,0 +1,7 @@ +module Def1 { + module B { header "b.h" } + module C { header "c.h" } +} +module Def2 { + header "d.h" +} diff --git a/clang/test/Modules/merge-class-definition-visibility.cpp b/clang/test/Modules/merge-class-definition-visibility.cpp new file mode 100644 index 00000000000..e8602c0d548 --- /dev/null +++ b/clang/test/Modules/merge-class-definition-visibility.cpp @@ -0,0 +1,15 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \ +// RUN: -I%S/Inputs/merge-class-definition-visibility \ +// RUN: -fmodules-cache-path=%t %s -verify +// expected-no-diagnostics + +#include "c.h" +template<typename T> struct X { T t; }; +typedef X<A> XA; + +#include "d.h" +// Ensure that this triggers the import of the second definition from d.h, +// which is necessary to make the definition of A visible in the template +// instantiation. +XA xa; |