diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-13 00:12:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-13 00:12:48 +0000 |
commit | 08dc584c3f939468cde6f4da87f77bb6d9741044 (patch) | |
tree | adffd73f9a5afd7300b1fb07ee07f9450edccc6d | |
parent | 7b1a7ed330212335bbaeca43a41dd7c2b19c4e1d (diff) | |
download | bcm5719-llvm-08dc584c3f939468cde6f4da87f77bb6d9741044.tar.gz bcm5719-llvm-08dc584c3f939468cde6f4da87f77bb6d9741044.zip |
Remove broken fix-it when a default function argument has been
redefined. There's a FIXME with an apology about why we don't try to
do better here. Fixes <rdar://problem/7513023>.
llvm-svn: 93274
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 0cd70026477..ffd10c89f0f 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -270,18 +270,18 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) { ParmVarDecl *NewParam = New->getParamDecl(p); if (OldParam->hasDefaultArg() && NewParam->hasDefaultArg()) { - // FIXME: If the parameter doesn't have an identifier then the location - // points to the '=' which means that the fixit hint won't remove any - // extra spaces between the type and the '='. - SourceLocation Begin = NewParam->getLocation(); - if (NewParam->getIdentifier()) - Begin = PP.getLocForEndOfToken(Begin); - + // FIXME: If we knew where the '=' was, we could easily provide a fix-it + // hint here. Alternatively, we could walk the type-source information + // for NewParam to find the last source location in the type... but it + // isn't worth the effort right now. This is the kind of test case that + // is hard to get right: + + // int f(int); + // void g(int (*fp)(int) = f); + // void g(int (*fp)(int) = &f); Diag(NewParam->getLocation(), diag::err_param_default_argument_redefinition) - << NewParam->getDefaultArgRange() - << CodeModificationHint::CreateRemoval(SourceRange(Begin, - NewParam->getLocEnd())); + << NewParam->getDefaultArgRange(); // Look for the function declaration where the default argument was // actually written, which may be a declaration prior to Old. |