[cfe-commits] PATCH: Add support for C++ namespace-aware typo correcting

Kaelyn Uhrain rikka at google.com
Thu Jun 23 11:23:42 PDT 2011

I've make the fixes/changes based on your latest feedback and added a
simplified unit test for one caller of CorrectTypo.  The chosen caller is
the one where requiresADL has to be propagated down to CorrectTypo to keep
from breaking test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp

On Wed, Jun 22, 2011 at 1:23 PM, Douglas Gregor <dgregor at apple.com> wrote:

> +    // If there are results in the closest bucket, stop
> +    if (!DI->second.empty()
> +        /* TODO: Fix ObjC tests (in particular SemaObjC/ivar-ref-misuse.m)
> */
> +        || (getLangOptions().ObjC1 && ED > 0))
> +      break;
> Is this still an issue to be resolved?

Yes.  Removing the ObjC-specific guard results in SemaObjC/ivar-ref-misuse.m
failing with the messages:

 error: 'error' diagnostics expected but not seen:
  Line 20: use of undeclared identifier 'Xsprite'
error: 'error' diagnostics seen but not expected:
  Line 20: unknown type name 'Xsprite'; did you mean 'Sprite'?
  Line 20: expected identifier or '('
error: 'note' diagnostics seen but not expected:
  Line 3: 'Sprite' declared here

I'm not sure if it would be better to leave the guard in place or to fix up
the test to account for the more diligent search for possible typo
correction (given the meaning of much of the syntax in
SemaObjC/ivar-ref-misuse.m is indecipherable to me).

> ... and one larger issue, which is that I'm seeing an infinite loop on this
> test case:
> #include <vector>
> #include <algorithm>
> int main() {
>  std::vector<int> v;
>  (sort)(v.begin(), v.end());
> }
> in the typo-correction logic.

D'oh! Found the problem and fixed it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110623/b72a7557/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ns-pt1-20110623.diff
Type: text/x-diff
Size: 52289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110623/b72a7557/attachment.diff>

More information about the cfe-commits mailing list