summaryrefslogtreecommitdiffstats
path: root/test/Index
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-02-02 08:40:08 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-02-02 08:40:08 +0000
commita2ca4ae98b35d76b14cc936af1ebf13b93199d79 (patch)
tree977603c3038bcb9da23ce17221ba2a1b5d8b89b7 /test/Index
parent08712fff7fba84b88e2e57b3c739d53b1aab1ed6 (diff)
[Sema] Add implicit members even for invalid CXXRecordDecls
Summary: It should be safe, since other code paths are already generating implicit members even in invalid CXXRecordDecls (e.g. lookup). If we don't generate implicit members on CXXRecordDecl's completion, they will be generated by next lookup of constructors. This causes a crash when the following conditions are met: - a CXXRecordDecl is invalid, - it is provided via ExternalASTSource (e.g. from PCH), - it has inherited constructors (they create ShadowDecls), - lookup of its constructors was not run before ASTWriter serialized it. This may require the ShadowDecls created for inherited constructors to be removed from the class, but that's no longer possible since class is provided by ExternalASTSource. See provided lit test for an example. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42810 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index')
-rw-r--r--test/Index/Inputs/crash-preamble-classes.h9
-rw-r--r--test/Index/crash-preamble-classes.cpp8
2 files changed, 17 insertions, 0 deletions
diff --git a/test/Index/Inputs/crash-preamble-classes.h b/test/Index/Inputs/crash-preamble-classes.h
new file mode 100644
index 0000000000..a8fb5cede0
--- /dev/null
+++ b/test/Index/Inputs/crash-preamble-classes.h
@@ -0,0 +1,9 @@
+struct Incomplete;
+
+struct X : Incomplete {
+ X();
+};
+
+struct Y : X {
+ using X::X;
+};
diff --git a/test/Index/crash-preamble-classes.cpp b/test/Index/crash-preamble-classes.cpp
new file mode 100644
index 0000000000..e7d4bd70ae
--- /dev/null
+++ b/test/Index/crash-preamble-classes.cpp
@@ -0,0 +1,8 @@
+#include "crash-preamble-classes.h"
+
+struct Z : Y {
+ Z() {}
+};
+
+// RUN: env CINDEXTEST_EDITING=1 \
+// RUN: c-index-test -test-load-source-reparse 5 local -I %S/Inputs %s