[cfe-commits] [PATCH] Fix typo correction of one qualified name to another.

Richard Smith reviews at llvm-reviews.chandlerc.com
Wed Oct 10 13:38:19 PDT 2012



================
Comment at: lib/Sema/SemaDeclCXX.cpp:5811-5819
@@ -5810,10 +5810,11 @@
     std::string CorrectedQuotedStr(Corrected.getQuoted(S.getLangOpts()));
-    if (DeclContext *DC = S.computeDeclContext(SS, false))
+    if (DeclContext *DC = S.computeDeclContext(SS, false)) {
       S.Diag(IdentLoc, diag::err_using_directive_member_suggest)
         << Ident << DC << CorrectedQuotedStr << SS.getRange()
-        << FixItHint::CreateReplacement(IdentLoc, CorrectedStr);
-    else
+        << FixItHint::CreateReplacement(Corrected.getCorrectionRange(),
+                                        CorrectedStr);
+    } else
       S.Diag(IdentLoc, diag::err_using_directive_suggest)
         << Ident << CorrectedQuotedStr
         << FixItHint::CreateReplacement(IdentLoc, CorrectedStr);
 
----------------
Seems a bit jarring to have braces for the 'if' but not for the 'else'.

================
Comment at: lib/Sema/SemaLookup.cpp:4059-4061
@@ -4058,3 +4058,5 @@
 
-    return Result;
+    TypoCorrection TC = Result;
+    TC.setCorrectionRange(SS, TypoName);
+    return TC;
   }
----------------
It makes me slightly uncomfortable that we're passing around partially-constructed TypoCorrections until we get here, but OK.


http://llvm-reviews.chandlerc.com/D57

BRANCH
  qualified_correction



More information about the cfe-commits mailing list