Like the subject says. :)  This trivial patch fixes half a FIXME.

Regards,

Eelis

>From 22b19392cd574a08a3e8b40b63e2ba343b47fa85 Mon Sep 17 00:00:00 2001
From: Eelis van der Weegen <[email protected]>
Date: Fri, 18 Nov 2011 20:52:03 +0100
Subject: [PATCH] Emit fix-it for misspelled types whose suggested correction is a keyword.

---
 lib/Sema/SemaDecl.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 418ca3c..f7ffab3 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -349,9 +349,10 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
 
     if (Corrected.isKeyword()) {
       // We corrected to a keyword.
-      // FIXME: Actually recover with the keyword we suggest, and emit a fix-it.
+      // FIXME: Actually recover with the keyword we suggest.
       Diag(IILoc, diag::err_unknown_typename_suggest)
-        << &II << CorrectedQuotedStr;
+        << &II << CorrectedQuotedStr
+        << FixItHint::CreateReplacement(SourceRange(IILoc), CorrectedStr);
       return true;      
     } else {
       NamedDecl *Result = Corrected.getCorrectionDecl();
-- 
1.7.3.4

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to