[cfe-commits] r68918 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Parser/declarators.c
Chris Lattner
sabre at nondot.org
Sun Apr 12 15:15:03 PDT 2009
Author: lattner
Date: Sun Apr 12 17:15:02 2009
New Revision: 68918
URL: http://llvm.org/viewvc/llvm-project?rev=68918&view=rev
Log:
fix another case that assumed that GetTypeForDeclarator would never return null.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Parser/declarators.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=68918&r1=68917&r2=68918&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Apr 12 17:15:02 2009
@@ -3623,10 +3623,8 @@
if (II) Loc = D.getIdentifierLoc();
QualType T = GetTypeForDeclarator(D, S);
-
- if (getLangOptions().CPlusPlus) {
+ if (getLangOptions().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
- }
DiagnoseFunctionSpecifiers(D);
@@ -3774,8 +3772,11 @@
// example, unnamed unions inject all members into the struct namespace!
QualType T = GetTypeForDeclarator(D, S);
- assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
bool InvalidDecl = false;
+ if (T.isNull()) {
+ InvalidDecl = true;
+ T = Context.IntTy;
+ }
if (BitWidth) {
// 6.7.2.1p3, 6.7.2.1p4
Modified: cfe/trunk/test/Parser/declarators.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/declarators.c?rev=68918&r1=68917&r2=68918&view=diff
==============================================================================
--- cfe/trunk/test/Parser/declarators.c (original)
+++ cfe/trunk/test/Parser/declarators.c Sun Apr 12 17:15:02 2009
@@ -64,4 +64,3 @@
static g = 4; // expected-warning {{type specifier missing, defaults to 'int'}}
static h // expected-warning {{type specifier missing, defaults to 'int'}}
__asm__("foo"); // expected-warning {{extension used}}
-
More information about the cfe-commits
mailing list