forked from OSchip/llvm-project
When injecting a definition for implicitly defined functions, do so at
translation-unit scope, so we only warn about each implicitly defined function once. This cuts the number of errors parsing carbon.h from 616 to 550. llvm-svn: 39325
This commit is contained in:
parent
efe4aea064
commit
62d2e662ac
|
@ -337,11 +337,11 @@ Decl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
|||
D.AddTypeInfo(DeclaratorChunk::getFunction(false, false, 0, 0, Loc));
|
||||
D.SetIdentifier(&II, Loc);
|
||||
|
||||
Decl *Result = static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
|
||||
// Find translation-unit scope to insert this function into.
|
||||
while (S->getParent())
|
||||
S = S->getParent();
|
||||
|
||||
// Visit this implicit declaration like any other top-level form.
|
||||
LastInGroupList.push_back(Result);
|
||||
return Result;
|
||||
return static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,6 +458,10 @@ Sema::DeclTy *Sema::ParseField(Scope *S, DeclTy *TagDecl,
|
|||
SourceLocation Loc = DeclStart;
|
||||
if (II) Loc = D.getIdentifierLoc();
|
||||
|
||||
// FIXME: Unnamed fields can be handled in various different ways, for
|
||||
// example, unnamed unions inject all members into the struct namespace!
|
||||
|
||||
|
||||
if (BitWidth) {
|
||||
// TODO: Validate.
|
||||
printf("WARNING: BITFIELDS IGNORED!\n");
|
||||
|
|
|
@ -337,11 +337,11 @@ Decl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
|||
D.AddTypeInfo(DeclaratorChunk::getFunction(false, false, 0, 0, Loc));
|
||||
D.SetIdentifier(&II, Loc);
|
||||
|
||||
Decl *Result = static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
|
||||
// Find translation-unit scope to insert this function into.
|
||||
while (S->getParent())
|
||||
S = S->getParent();
|
||||
|
||||
// Visit this implicit declaration like any other top-level form.
|
||||
LastInGroupList.push_back(Result);
|
||||
return Result;
|
||||
return static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,6 +458,10 @@ Sema::DeclTy *Sema::ParseField(Scope *S, DeclTy *TagDecl,
|
|||
SourceLocation Loc = DeclStart;
|
||||
if (II) Loc = D.getIdentifierLoc();
|
||||
|
||||
// FIXME: Unnamed fields can be handled in various different ways, for
|
||||
// example, unnamed unions inject all members into the struct namespace!
|
||||
|
||||
|
||||
if (BitWidth) {
|
||||
// TODO: Validate.
|
||||
printf("WARNING: BITFIELDS IGNORED!\n");
|
||||
|
|
Loading…
Reference in New Issue