[cfe-commits] r54592 - in /cfe/trunk: clang.xcodeproj/project.pbxproj lib/AST/ASTContext.cpp test/Sema/invalid-decl.c
Chris Lattner
sabre at nondot.org
Sat Aug 9 14:35:14 PDT 2008
Author: lattner
Date: Sat Aug 9 16:35:13 2008
New Revision: 54592
URL: http://llvm.org/viewvc/llvm-project?rev=54592&view=rev
Log:
Fix PR2400 by more graceful handling of invalid decls. Don't try to layout
an invalid struct decl. Thanks to Martin Doucha for the
isIncompleteArrayType part of this patch.
Modified:
cfe/trunk/clang.xcodeproj/project.pbxproj
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Sema/invalid-decl.c
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=54592&r1=54591&r2=54592&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Sat Aug 9 16:35:13 2008
@@ -885,19 +885,19 @@
DEC8D9920A9433F400353FCA /* AST */ = {
isa = PBXGroup;
children = (
- 35EE48AF0E0C4CCA00715C54 /* DeclCXX.cpp */,
- 35EE48B00E0C4CCA00715C54 /* ParentMap.cpp */,
35BB2D7E0D19954000944DB5 /* ASTConsumer.cpp */,
DE1732FF0B068B700080B521 /* ASTContext.cpp */,
DED677C80B6C854100AAD4A3 /* Builtins.cpp */,
DEC63B190C7B940200DBF169 /* CFG.cpp */,
35FE6BCE0DF6EE1F00739712 /* DeclBase.cpp */,
DED62ABA0AE2EDF1001E80A4 /* Decl.cpp */,
+ 35EE48AF0E0C4CCA00715C54 /* DeclCXX.cpp */,
DE38CF260D8C9E6C00A273B6 /* DeclObjC.cpp */,
3513185F0CD14468006B66F7 /* DeclSerialization.cpp */,
DE0FCB330A9C21F100248FD5 /* Expr.cpp */,
1A32C17E0E1C87AD00A6B483 /* ExprConstant.cpp */,
35260CA40C7F75C000D66CE9 /* ExprCXX.cpp */,
+ 35EE48B00E0C4CCA00715C54 /* ParentMap.cpp */,
DE3452400AEF1A2D00DBC861 /* Stmt.cpp */,
DEF2EDA60C6A4252000C4259 /* StmtDumper.cpp */,
DE34621C0AFEB19B00DBC861 /* StmtPrinter.cpp */,
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=54592&r1=54591&r2=54592&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Aug 9 16:35:13 2008
@@ -325,6 +325,12 @@
break;
}
case Type::Tagged: {
+ if (cast<TagType>(T)->getDecl()->isInvalidDecl()) {
+ Width = 1;
+ Align = 1;
+ break;
+ }
+
if (EnumType *ET = dyn_cast<EnumType>(cast<TagType>(T)))
return getTypeInfo(ET->getDecl()->getIntegerType());
@@ -377,8 +383,8 @@
if (!FD->getIdentifier())
FieldAlign = 1;
} else {
- if (FD->getType()->isIncompleteType()) {
- // This must be a flexible array member; we can't directly
+ if (FD->getType()->isIncompleteArrayType()) {
+ // This is a flexible array member; we can't directly
// query getTypeInfo about these, so we figure it out here.
// Flexible array members don't have any size, but they
// have to be aligned appropriately for their element type.
Modified: cfe/trunk/test/Sema/invalid-decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/invalid-decl.c?rev=54592&r1=54591&r2=54592&view=diff
==============================================================================
--- cfe/trunk/test/Sema/invalid-decl.c (original)
+++ cfe/trunk/test/Sema/invalid-decl.c Sat Aug 9 16:35:13 2008
@@ -6,3 +6,15 @@
}
+// PR2400
+typedef xtype (*zend_stream_fsizer_t)(void* handle); // expected-error {{function cannot return array or function type}}
+
+typedef struct _zend_module_entry zend_module_entry;
+struct _zend_module_entry {
+ xtype globals_size; // expected-error {{field 'globals_size' declared as a function}}
+};
+
+zend_module_entry openssl_module_entry = {
+ sizeof(zend_module_entry)
+};
+
More information about the cfe-commits
mailing list