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
diff --git a/clang/AST/SemaDecl.cpp b/clang/AST/SemaDecl.cpp
index bb114cd..408b1f5 100644
--- a/clang/AST/SemaDecl.cpp
+++ b/clang/AST/SemaDecl.cpp
@@ -127,8 +127,12 @@
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