[PATCH] D50943: Decl: allow "setInvalidDecl" for TagDecls

Steve O'Brien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 18 19:02:55 PDT 2018


elsteveogrande created this revision.
elsteveogrande added a reviewer: rsmith.
Herald added a subscriber: cfe-commits.

For `TagDecl`s, complete or incomplete, allow `setInvalidDecl` calls.

Other `assert`s are interfering but we'll deal with them separately.

https://bugs.llvm.org/show_bug.cgi?id=38531


Repository:
  rC Clang

https://reviews.llvm.org/D50943

Files:
  lib/AST/DeclBase.cpp


Index: lib/AST/DeclBase.cpp
===================================================================
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -131,11 +131,12 @@
 
 void Decl::setInvalidDecl(bool Invalid) {
   InvalidDecl = Invalid;
-  assert(!isa<TagDecl>(this) || !cast<TagDecl>(this)->isCompleteDefinition());
   if (!Invalid) {
     return;
   }
 
+  assert(!isa<TagDecl>(this) || !cast<TagDecl>(this)->isCompleteDefinition());
+
   if (!isa<ParmVarDecl>(this)) {
     // Defensive maneuver for ill-formed code: we're likely not to make it to
     // a point where we set the access specifier, so default it to "public"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50943.161390.patch
Type: text/x-patch
Size: 630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180819/56e25c8a/attachment.bin>


More information about the cfe-commits mailing list