[clang] 3466ceb - Add a test to cover structural match for recursive data types
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 18:34:32 PST 2019
Author: Bruno Cardoso Lopes
Date: 2019-11-14T18:32:27-08:00
New Revision: 3466cebe94ba461b296bb1314e76118cc2823dfb
URL: https://github.com/llvm/llvm-project/commit/3466cebe94ba461b296bb1314e76118cc2823dfb
DIFF: https://github.com/llvm/llvm-project/commit/3466cebe94ba461b296bb1314e76118cc2823dfb.diff
LOG: Add a test to cover structural match for recursive data types
This didn't use to work prior to r370639, now that this is supported
add a testcase to prevent regressions.
rdar://problem/53602368
Added:
clang/test/Modules/Inputs/rec-types/a.h
clang/test/Modules/Inputs/rec-types/b.h
clang/test/Modules/Inputs/rec-types/c.h
clang/test/Modules/Inputs/rec-types/module.modulemap
clang/test/Modules/structural-equivalent-recursive-types.c
Modified:
Removed:
################################################################################
diff --git a/clang/test/Modules/Inputs/rec-types/a.h b/clang/test/Modules/Inputs/rec-types/a.h
new file mode 100644
index 000000000000..8e88ea7c5042
--- /dev/null
+++ b/clang/test/Modules/Inputs/rec-types/a.h
@@ -0,0 +1,2 @@
+// rec-types/a.h
+#include "b.h"
diff --git a/clang/test/Modules/Inputs/rec-types/b.h b/clang/test/Modules/Inputs/rec-types/b.h
new file mode 100644
index 000000000000..05bbd99dd580
--- /dev/null
+++ b/clang/test/Modules/Inputs/rec-types/b.h
@@ -0,0 +1,2 @@
+// rec-types/b.h
+#include "c.h"
diff --git a/clang/test/Modules/Inputs/rec-types/c.h b/clang/test/Modules/Inputs/rec-types/c.h
new file mode 100644
index 000000000000..fd2eb5a259b0
--- /dev/null
+++ b/clang/test/Modules/Inputs/rec-types/c.h
@@ -0,0 +1,7 @@
+struct some_descriptor
+{
+ // commenting line above make this struct work
+ void *(*thunk)(struct some_descriptor *);
+ unsigned long key;
+};
+
diff --git a/clang/test/Modules/Inputs/rec-types/module.modulemap b/clang/test/Modules/Inputs/rec-types/module.modulemap
new file mode 100644
index 000000000000..680ed71ac9f2
--- /dev/null
+++ b/clang/test/Modules/Inputs/rec-types/module.modulemap
@@ -0,0 +1,9 @@
+module a {
+ header "a.h"
+ // Hide content by not re-exporting module b.
+}
+
+module b {
+ header "b.h"
+ export *
+}
diff --git a/clang/test/Modules/structural-equivalent-recursive-types.c b/clang/test/Modules/structural-equivalent-recursive-types.c
new file mode 100644
index 000000000000..bb3ec7b499bb
--- /dev/null
+++ b/clang/test/Modules/structural-equivalent-recursive-types.c
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/rec-types -fsyntax-only %s -verify
+#include "a.h"
+#include "c.h"
+void foo(struct some_descriptor *st) { (void)st->thunk; }
+
+// expected-no-diagnostics
More information about the cfe-commits
mailing list