<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Incomplete cursor traversal: Lambda function param"
   href="http://llvm.org/bugs/show_bug.cgi?id=22184">22184</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incomplete cursor traversal: Lambda function param
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libclang
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>contact@jeaye.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the code (as foo.cpp):

#include <vector>
#include <string>
#include <functional>

int main()
{
  std::vector<std::function<std::string (std::string const&)>> v
  {
    [&](std::string const &str) -> std::string
    { return str; }
  };
}

and the example test code: <a href="https://gist.github.com/jeaye/6e04855778086c1e5d24">https://gist.github.com/jeaye/6e04855778086c1e5d24</a>
the resulting output is currently (trunk as of 01-10-15):

<a href="https://gist.github.com/jeaye/78ae7c98156afc5dfa34">https://gist.github.com/jeaye/78ae7c98156afc5dfa34</a>

The issue is shown starting at line 46 in the output, where the namespace ref
(std), the type ref (string), and the variable (str) are given the cursor
LambdaExpr instead of their closest cursors (as listed inline).

After my commit:
<a href="https://github.com/jeaye/clang/commit/d5e32aa70903556a5181f45ee6b9975864b890ba">https://github.com/jeaye/clang/commit/d5e32aa70903556a5181f45ee6b9975864b890ba</a>
the result is:

<a href="https://gist.github.com/jeaye/81e5e58f3da3bf2334d8">https://gist.github.com/jeaye/81e5e58f3da3bf2334d8</a>

Note, on the same starting line of the output (46), the namespace, type, and
variable are all given the correct cursor. An inline diff of the two outputs:

@@ -43,12 +43,12 @@
 &, LambdaExpr, Record, 
 ], LambdaExpr, Record, 
 (, LambdaExpr, Record, 
-std, LambdaExpr, Record, 
-::, LambdaExpr, Record, 
-string, LambdaExpr, Record, 
-const, LambdaExpr, Record, 
-&, LambdaExpr, Record, 
-str, LambdaExpr, Record, 
+std, NamespaceRef, Invalid, std
+::, ParmDecl, LValueReference, str
+string, TypeRef, Typedef, string
+const, ParmDecl, LValueReference, str
+&, ParmDecl, LValueReference, str
+str, ParmDecl, LValueReference, str
 ), LambdaExpr, Record, 
 ->, LambdaExpr, Record, 
 std, NamespaceRef, Invalid, std</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>