зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
690c2e22d4
Коммит
aeb4a28256
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче