summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2015-12-10 17:28:51 +0000
committerBen Langmuir <blangmuir@apple.com>2015-12-10 17:28:51 +0000
commitc589462beb36d4d529dc70fb330546dce22061ff (patch)
tree429b598c703240dcd060da0a8eab10db6f635087 /clang/test/Modules
parentb247bfb23b1c19ba2b78f61456f20d6924f2ef9d (diff)
downloadbcm5719-llvm-c589462beb36d4d529dc70fb330546dce22061ff.tar.gz
bcm5719-llvm-c589462beb36d4d529dc70fb330546dce22061ff.zip
[Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag
This makes non-C++ languages find the same decl as C++ does to workaround a regression introduced in r252960. rdar://problem/23784203 llvm-svn: 255267
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/elaborated-type-structs.h3
-rw-r--r--clang/test/Modules/Inputs/module.map7
-rw-r--r--clang/test/Modules/elaborated-type-specifier-from-hidden-module.m18
3 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/elaborated-type-structs.h b/clang/test/Modules/Inputs/elaborated-type-structs.h
new file mode 100644
index 00000000000..da3940998fd
--- /dev/null
+++ b/clang/test/Modules/Inputs/elaborated-type-structs.h
@@ -0,0 +1,3 @@
+struct S1;
+struct S2 { int x; };
+struct S3 { int x; };
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 226d45fdf44..632517dd363 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -386,3 +386,10 @@ module TypedefTag {
header "typedef-tag-hidden.h"
}
}
+
+module ElaboratedTypeStructs {
+ module Empty {}
+ module Structs {
+ header "elaborated-type-structs.h"
+ }
+}
diff --git a/clang/test/Modules/elaborated-type-specifier-from-hidden-module.m b/clang/test/Modules/elaborated-type-specifier-from-hidden-module.m
new file mode 100644
index 00000000000..0ca1c24bba0
--- /dev/null
+++ b/clang/test/Modules/elaborated-type-specifier-from-hidden-module.m
@@ -0,0 +1,18 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify
+
+@import ElaboratedTypeStructs.Empty; // The structs are now hidden.
+struct S1 *x;
+struct S2 *y;
+// FIXME: compatible definition should not be an error.
+struct S2 { int x; }; // expected-error {{redefinition}}
+struct S3 *z;
+// Incompatible definition.
+struct S3 { float y; }; // expected-error {{redefinition}}
+// expected-note@elaborated-type-structs.h:* 2 {{previous definition is here}}
+
+@import ElaboratedTypeStructs.Structs;
+
+void useS1(struct S1 *x);
+void useS2(struct S2 *x);
+void useS2(struct S2 *x);
OpenPOWER on IntegriCloud