summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-12 22:15:02 +0000
committerChris Lattner <sabre@nondot.org>2009-04-12 22:15:02 +0000
commit090d34c692824656017562ebb781a889ea281eac (patch)
treed8fe460f4106bc74ae5519095f6f16b3e4e22bbc
parent67b0d6afaab0bc1c0b80588432e6eede7f2cc5cf (diff)
downloadbcm5719-llvm-090d34c692824656017562ebb781a889ea281eac.tar.gz
bcm5719-llvm-090d34c692824656017562ebb781a889ea281eac.zip
fix another case that assumed that GetTypeForDeclarator would never return null.
llvm-svn: 68918
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
-rw-r--r--clang/test/Parser/declarators.c1
2 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6c2440ff68e..7d276178916 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3623,10 +3623,8 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
if (II) Loc = D.getIdentifierLoc();
QualType T = GetTypeForDeclarator(D, S);
-
- if (getLangOptions().CPlusPlus) {
+ if (getLangOptions().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
- }
DiagnoseFunctionSpecifiers(D);
@@ -3774,8 +3772,11 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
// 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
diff --git a/clang/test/Parser/declarators.c b/clang/test/Parser/declarators.c
index d8cd5b6586c..a4b2aad09d8 100644
--- a/clang/test/Parser/declarators.c
+++ b/clang/test/Parser/declarators.c
@@ -64,4 +64,3 @@ static f; // expected-warning {{type specifier missing, defaults to 'int'}}
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}}
-
OpenPOWER on IntegriCloud