diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-27 21:28:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-27 21:28:21 +0000 |
commit | fd42e9542c5e01f9ecbdd8c023fa5eb6ef9e8c99 (patch) | |
tree | f592f4c7ce566ca3e9c7b8dd5cb1ce07e8d904f1 | |
parent | 6debf89587f53bb18a2c52a74de13c9d36945822 (diff) | |
download | bcm5719-llvm-fd42e9542c5e01f9ecbdd8c023fa5eb6ef9e8c99.tar.gz bcm5719-llvm-fd42e9542c5e01f9ecbdd8c023fa5eb6ef9e8c99.zip |
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.
llvm-svn: 104889
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 148d1463c20..9697f1357fe 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/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. |