[PATCH] D42810: [Sema] Add implicit members even for invalid CXXRecordDecls

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 00:41:56 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC324062: [Sema] Add implicit members even for invalid CXXRecordDecls (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42810?vs=132443&id=132546#toc

Repository:
  rC Clang

https://reviews.llvm.org/D42810

Files:
  lib/Sema/SemaDecl.cpp
  test/Index/Inputs/crash-preamble-classes.h
  test/Index/crash-preamble-classes.cpp


Index: test/Index/Inputs/crash-preamble-classes.h
===================================================================
--- test/Index/Inputs/crash-preamble-classes.h
+++ test/Index/Inputs/crash-preamble-classes.h
@@ -0,0 +1,9 @@
+struct Incomplete;
+
+struct X : Incomplete {
+  X();
+};
+
+struct Y : X {
+  using X::X;
+};
Index: test/Index/crash-preamble-classes.cpp
===================================================================
--- test/Index/crash-preamble-classes.cpp
+++ 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
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -15440,10 +15440,10 @@
                                           CXXRecord->getDestructor());
         }
 
-        if (!CXXRecord->isInvalidDecl()) {
-          // Add any implicitly-declared members to this class.
-          AddImplicitlyDeclaredMembersToClass(CXXRecord);
+        // Add any implicitly-declared members to this class.
+        AddImplicitlyDeclaredMembersToClass(CXXRecord);
 
+        if (!CXXRecord->isInvalidDecl()) {
           // If we have virtual base classes, we may end up finding multiple
           // final overriders for a given virtual function. Check for this
           // problem now.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42810.132546.patch
Type: text/x-patch
Size: 1491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180202/07c94378/attachment.bin>


More information about the cfe-commits mailing list