r185446 - Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.

Serge Pavlov sepavloff at gmail.com
Tue Jul 2 10:31:56 PDT 2013


Author: sepavloff
Date: Tue Jul  2 12:31:56 2013
New Revision: 185446

URL: http://llvm.org/viewvc/llvm-project?rev=185446&view=rev
Log:
Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.

Added:
    cfe/trunk/test/CodeGen/PR15826.c
Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=185446&r1=185445&r2=185446&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jul  2 12:31:56 2013
@@ -10483,7 +10483,8 @@ void Sema::ActOnTagFinishDefinition(Scop
     Tag->setTopLevelDeclInObjCContainer();
 
   // Notify the consumer that we've defined a tag.
-  Consumer.HandleTagDeclDefinition(Tag);
+  if (!Tag->isInvalidDecl())
+    Consumer.HandleTagDeclDefinition(Tag);
 }
 
 void Sema::ActOnObjCContainerFinishDefinition() {

Added: cfe/trunk/test/CodeGen/PR15826.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR15826.c?rev=185446&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/PR15826.c (added)
+++ cfe/trunk/test/CodeGen/PR15826.c Tue Jul  2 12:31:56 2013
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -verify -emit-llvm %s
+
+/* Testcase for PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout */
+struct sysctl_req {
+  struct aiocblist *p_aio;
+};
+
+struct sysctl_oid {
+  int (*oid_handler)(struct sysctl_req *req);
+};
+
+static struct sysctl_oid sysctl___kern_features_aio;
+
+static void const *const __set_sysctl_set_sym_sysctl___kern_features_aio
+    __attribute__((__used__)) = &sysctl___kern_features_aio;
+
+struct aiocblist {
+  struct aiocb uaiocb; // expected-error {{field has incomplete type}} expected-note {{forward declaration}}
+};





More information about the cfe-commits mailing list