<div class="gmail_quote">On Wed, Jan 11, 2012 at 11:49 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">A few comments inline...</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="im">On Wed, Jan 11, 2012 at 11:37 AM, Kaelyn Uhrain <span dir="ltr"><<a href="mailto:rikka@google.com" target="_blank">rikka@google.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=147962&r1=147961&r2=147962&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=147962&r1=147961&r2=147962&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jan 11 13:37:46 2012<br>
@@ -1745,6 +1745,30 @@<br>
                              EllipsisLoc);<br>
 }<br>
<br>
+namespace {<br>
+<br>
+// Callback to only accept typo corrections that are namespaces.<br></blockquote><div><br></div></div><div>I think this comment was cut/pasted from the other callback.</div></div></blockquote><div><br></div><div>Whoops! Yes, it was.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Modified: cfe/trunk/test/SemaCXX/typo-correction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction.cpp?rev=147962&r1=147961&r2=147962&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction.cpp?rev=147962&r1=147961&r2=147962&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/test/SemaCXX/typo-correction.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/typo-correction.cpp Wed Jan 11 13:37:46 2012<br>
@@ -29,3 +29,14 @@<br>
 inline error_condition make_error_condition(errc _e) {<br>
   return error_condition(static_cast<int>(_e));<br>
 }<br>
+<br>
+<br>
+// Prior to the introduction of a callback object to further filter possible<br>
+// typo corrections, this example would not trigger a suggestion as "base_type"<br>
+// is a closer match to "basetype" than is "BaseType" but "base_type" does not<br>
+// refer to a base class or non-static data member.<br>
+struct BaseType { };<br>
+struct Derived : public BaseType { // expected-note {{base class 'BaseType' specified here}}<br>
+  static int base_type;<br>
+  Derived() : basetype() {} // expected-error{{initializer 'basetype' does not name a non-static data member or base class; did you mean the base class 'BaseType'?}}<br>
+};</blockquote><div><br></div></div><div>It would be good to try to add similar examples for the other two code paths you switched to the callback mechanism. </div></div>
</blockquote></div><br><div>The code path in SemaLookup that uses the callback mechanism is emulating the functionality of CorrectTypoContext within the old version of CorrectTypo, so shouldn't change any behavior.</div>
<div><br></div><div>I started to add an example for the other code path in SemaDeclCXX.cpp, but discovered that (as far as I could tell) there isn't any change in behavior from the switch as CorrectTypo is also being passed LookupNamespaceName for the Sema::LookupNameKind--meaning CorrectTypo only receives namespace identifiers from the LookupVisibleDecls helper function. Looking again at the code in CorrectTypo just now, I think it *might* be possible to slip in a correction candidate which LookupVisibleDecls won't return when requested to only look up namespace names... by having the same namespace typo for something that isn't a namespace. If that works, I'll commit the example along with the comment fix.</div>
<div><br></div><div>Cheers,</div><div>Kaelyn</div>