[cfe-commits] r93274 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Tue Jan 12 16:12:49 PST 2010
Author: dgregor
Date: Tue Jan 12 18:12:48 2010
New Revision: 93274
URL: http://llvm.org/viewvc/llvm-project?rev=93274&view=rev
Log:
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>.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=93274&r1=93273&r2=93274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Jan 12 18:12:48 2010
@@ -270,18 +270,18 @@
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.
More information about the cfe-commits
mailing list