[llvm-branch-commits] [cfe-branch] r105035 - /cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp

Daniel Dunbar daniel at zuster.org
Fri May 28 16:06:37 PDT 2010


Author: ddunbar
Date: Fri May 28 18:06:37 2010
New Revision: 105035

URL: http://llvm.org/viewvc/llvm-project?rev=105035&view=rev
Log:
Merge r104889:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Thu May 27 21:28:21 2010 +0000

    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/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp?rev=105035&r1=105034&r2=105035&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp Fri May 28 18:06:37 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 llvm-branch-commits mailing list