Start doing trivial merging of function prototypes. If we have a function

proto, then a function body, and they have the same type, don't emit an error.
This reduces #errors from 654->616

llvm-svn: 39324
This commit is contained in:
Chris Lattner 2007-01-27 19:35:39 +00:00
parent c511efbcfc
commit efe4aea064
2 changed files with 12 additions and 4 deletions

View File

@ -127,8 +127,12 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
return New;
}
// This is not right, but it's a start. If 'Old' is a
// This is not right, but it's a start. If 'Old' is a function prototype with
// the same type as 'New', silently allow this. FIXME: We should link up decl
// objects here.
if (Old->getBody() == 0 && Old->getType() == New->getType()) {
return New;
}
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
// TODO: This is totally simplistic. It should handle merging functions

View File

@ -127,8 +127,12 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
return New;
}
// This is not right, but it's a start. If 'Old' is a
// This is not right, but it's a start. If 'Old' is a function prototype with
// the same type as 'New', silently allow this. FIXME: We should link up decl
// objects here.
if (Old->getBody() == 0 && Old->getType() == New->getType()) {
return New;
}
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
// TODO: This is totally simplistic. It should handle merging functions