From 55d857b142b0ccc0b3a53b0e510e527b0df409c6 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 20 Jun 2015 01:05:19 +0000 Subject: [modules] When determining whether a definition of a class is visible, check all modules even if we've already found a definition that's not visible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240204 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Modules/Inputs/merge-class-definition-visibility/a.h | 1 + test/Modules/Inputs/merge-class-definition-visibility/b.h | 2 ++ test/Modules/Inputs/merge-class-definition-visibility/c.h | 1 + test/Modules/Inputs/merge-class-definition-visibility/d.h | 1 + .../Inputs/merge-class-definition-visibility/modmap | 7 +++++++ test/Modules/merge-class-definition-visibility.cpp | 15 +++++++++++++++ 6 files changed, 27 insertions(+) create mode 100644 test/Modules/Inputs/merge-class-definition-visibility/a.h create mode 100644 test/Modules/Inputs/merge-class-definition-visibility/b.h create mode 100644 test/Modules/Inputs/merge-class-definition-visibility/c.h create mode 100644 test/Modules/Inputs/merge-class-definition-visibility/d.h create mode 100644 test/Modules/Inputs/merge-class-definition-visibility/modmap create mode 100644 test/Modules/merge-class-definition-visibility.cpp (limited to 'test') diff --git a/test/Modules/Inputs/merge-class-definition-visibility/a.h b/test/Modules/Inputs/merge-class-definition-visibility/a.h new file mode 100644 index 0000000000..4c5cd949f2 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/a.h @@ -0,0 +1 @@ +struct A {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/b.h b/test/Modules/Inputs/merge-class-definition-visibility/b.h new file mode 100644 index 0000000000..2b8f5f868e --- /dev/null +++ b/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/test/Modules/Inputs/merge-class-definition-visibility/c.h b/test/Modules/Inputs/merge-class-definition-visibility/c.h new file mode 100644 index 0000000000..27f503c2c6 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/c.h @@ -0,0 +1 @@ +struct A; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/d.h b/test/Modules/Inputs/merge-class-definition-visibility/d.h new file mode 100644 index 0000000000..2243de1baf --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/d.h @@ -0,0 +1 @@ +#include "a.h" diff --git a/test/Modules/Inputs/merge-class-definition-visibility/modmap b/test/Modules/Inputs/merge-class-definition-visibility/modmap new file mode 100644 index 0000000000..7d988fbba0 --- /dev/null +++ b/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/test/Modules/merge-class-definition-visibility.cpp b/test/Modules/merge-class-definition-visibility.cpp new file mode 100644 index 0000000000..e8602c0d54 --- /dev/null +++ b/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 struct X { T t; }; +typedef X 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; -- cgit v1.2.1