[cfe-commits] r104889 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Thu May 27 14:28:21 PDT 2010
Author: dgregor
Date: Thu May 27 16:28:21 2010
New Revision: 104889
URL: http://llvm.org/viewvc/llvm-project?rev=104889&view=rev
Log:
Tweak the fix-it for a copy constructor declared to take its argument
by-value. We now only prepend a space if it is needed.
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=104889&r1=104888&r2=104889&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu May 27 16:28:21 2010
@@ -2990,8 +2990,11 @@
QualType ClassTy = Context.getTagDeclType(ClassDecl);
if (Context.getCanonicalType(ParamType).getUnqualifiedType() == ClassTy) {
SourceLocation ParamLoc = Constructor->getParamDecl(0)->getLocation();
+ const char *ConstRef
+ = Constructor->getParamDecl(0)->getIdentifier() ? "const &"
+ : " const &";
Diag(ParamLoc, diag::err_constructor_byvalue_arg)
- << FixItHint::CreateInsertion(ParamLoc, " const &");
+ << FixItHint::CreateInsertion(ParamLoc, ConstRef);
// FIXME: Rather that making the constructor invalid, we should endeavor
// to fix the type.
More information about the cfe-commits
mailing list