forked from OSchip/llvm-project
fix a valgrind problem I noticed while developing another patch,
if a decl is invalid, it isn't added to the Decls array, so we need to pass in Decls.size() to avoid reading uninit memory. llvm-svn: 68913
This commit is contained in:
parent
109af6232b
commit
14bdb78430
|
@ -2620,7 +2620,7 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group,
|
|||
}
|
||||
}
|
||||
return DeclGroupPtrTy::make(DeclGroupRef::Create(Context,
|
||||
&Decls[0], NumDecls));
|
||||
&Decls[0], Decls.size()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@ typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anony
|
|||
void x();
|
||||
int a() {
|
||||
int r[x()]; // expected-error {{size of array has non-integer type 'void'}}
|
||||
|
||||
static y ?; // expected-error{{unknown type name 'y'}} \
|
||||
expected-error{{expected identifier or '('}} \
|
||||
expected-error{{expected ';' at end of declaration}}
|
||||
}
|
||||
|
||||
int; // expected-error {{declaration does not declare anything}}
|
||||
|
|
Loading…
Reference in New Issue