From: Serge Pavlov Date: Tue, 2 Jul 2013 17:31:56 +0000 (+0000) Subject: Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=439b7011de1c5089f255bbd98485b5620de5dadb;p=clang Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185446 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 2d40f152b1..8e86389652 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -10483,7 +10483,8 @@ void Sema::ActOnTagFinishDefinition(Scope *S, Decl *TagD, Tag->setTopLevelDeclInObjCContainer(); // Notify the consumer that we've defined a tag. - Consumer.HandleTagDeclDefinition(Tag); + if (!Tag->isInvalidDecl()) + Consumer.HandleTagDeclDefinition(Tag); } void Sema::ActOnObjCContainerFinishDefinition() { diff --git a/test/CodeGen/PR15826.c b/test/CodeGen/PR15826.c new file mode 100644 index 0000000000..e002c3e610 --- /dev/null +++ b/test/CodeGen/PR15826.c @@ -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}} +};