summaryrefslogtreecommitdiffstats
path: root/test/ASTMerge
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2016-05-14 05:43:57 +0000
committerSean Callanan <scallanan@apple.com>2016-05-14 05:43:57 +0000
commitd944e0ebaf7d183c01510e16dd61791ce608d23f (patch)
tree12199be5314c7c121b818344a5bba9084e9b02e7 /test/ASTMerge
parent9b9908a0472aed5c794e69a166bcb5dd1564f301 (diff)
Handle injected class names in the ASTImporter.
Every class as parsed by Clang has a forward declaration of itself as a member: class A { class A; ... } but when the parser generates this it ensures that the RecordTypes for the two are the same. This makes (among other things) inheritance work. This patch fixes a bug where the ASTImporter generated two separate RecordTypes when importing the class and the contained forward declaration, and adds a test case. Thanks to Doug Gregor for advice on this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge')
-rw-r--r--test/ASTMerge/Inputs/inheritance-base.cpp7
-rw-r--r--test/ASTMerge/inheritance.cpp8
2 files changed, 15 insertions, 0 deletions
diff --git a/test/ASTMerge/Inputs/inheritance-base.cpp b/test/ASTMerge/Inputs/inheritance-base.cpp
new file mode 100644
index 0000000000..26fe42eb64
--- /dev/null
+++ b/test/ASTMerge/Inputs/inheritance-base.cpp
@@ -0,0 +1,7 @@
+class A
+{
+public:
+ int x;
+ A(int _x) : x(_x) {
+ }
+};
diff --git a/test/ASTMerge/inheritance.cpp b/test/ASTMerge/inheritance.cpp
new file mode 100644
index 0000000000..7fce82a736
--- /dev/null
+++ b/test/ASTMerge/inheritance.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -emit-pch -o %t.1.ast %S/Inputs/inheritance-base.cpp
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -ast-merge %t.1.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class B : public A {
+ B(int _a) : A(_a) {
+ }
+};