patch: fix typo-correction vs overload

Nick Lewycky nlewycky at google.com
Mon Apr 8 16:35:22 PDT 2013


The problem is best explained with a testcase:

struct A {};
struct B {};

struct S {
  void method(A*);
  void method(B*);
};

void test() {
  B b;
  S s;
  s.methodd(&b);
}

we currently typo-correct the "s.methodd" to "s.method" but refer to the
NamedDecl* for "void method(A*);" both in the note and when continuing to
parse. That in turn causes an extra diagnostics (can't convert B* to A*),
but worse in my mind is the fact that the parser isn't recovering as though
the suggested replacement text were applied.

Patch attached, now we recover by returning a LookupResult with all the
overload candidates found by looking up the typo-corrected name, and we
don't emit the note pointing to the previous decl(s) in case of overloaded
results. Please review closely, I'm not very familiar with this part of
clang.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130408/7c0a4512/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typo-member-expr-1.patch
Type: application/octet-stream
Size: 2905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130408/7c0a4512/attachment.obj>


More information about the cfe-commits mailing list