aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-27 21:28:21 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-27 21:28:21 +0000
commitaeb4a28256a924d57b111842647cbd40ab67f6f0 (patch)
treeedabbcfe4a2f7cedbe3710be7512075a8b9c4fc0 /lib
parent690c2e22d48c37fa590e9e93595fc5c5ee0d1eab (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 148d1463c2..9697f1357f 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2990,8 +2990,11 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
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.