aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6f0f351000..882ec0e1a4 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -290,8 +290,13 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
// A function that has already been declared has been redeclared or defined
// with a different type- show appropriate diagnostic
- diag::kind PrevDiag = Old->getBody() ? diag::err_previous_definition :
- diag::err_previous_declaration;
+ diag::kind PrevDiag;
+ if (Old->getBody())
+ PrevDiag = diag::err_previous_definition;
+ else if (Old->isImplicit())
+ PrevDiag = diag::err_previous_implicit_declaration;
+ else
+ PrevDiag = diag::err_previous_declaration;
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
// TODO: This is totally simplistic. It should handle merging functions
@@ -1181,7 +1186,10 @@ ScopedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
while (S->getParent())
S = S->getParent();
- return dyn_cast<ScopedDecl>(static_cast<Decl*>(ActOnDeclarator(S, D, 0)));
+ FunctionDecl *FD =
+ dyn_cast<FunctionDecl>(static_cast<Decl*>(ActOnDeclarator(S, D, 0)));
+ FD->setImplicit();
+ return FD;
}