aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-04 17:22:27 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-04 17:22:27 +0000
commit5862f0e1ac29c5af8089b4bf119fd4493f6ab58c (patch)
treeece787c2dc2e575a286b8b4797468b82f0cb7910 /lib/Sema
parentcd5ce091a18bdc601758495b583d33f8667f4272 (diff)
When emitting a "too many arguments to function call..." error, also include a note with a location for the function prototype.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaExpr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9ebc7de84d..55155efa69 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4385,6 +4385,13 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
<< NumArgsInProto << NumArgs << Fn->getSourceRange()
<< SourceRange(Args[NumArgsInProto]->getLocStart(),
Args[NumArgs-1]->getLocEnd());
+
+ // Emit the location of the prototype.
+ if (FDecl && !FDecl->getBuiltinID())
+ Diag(FDecl->getLocStart(),
+ diag::note_typecheck_call_too_many_args)
+ << FDecl;
+
// This deletes the extra arguments.
Call->setNumArgs(Context, NumArgsInProto);
return true;