[LLVMbugs] [Bug 22184] New: Incomplete cursor traversal: Lambda function param

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jan 10 07:12:21 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22184

            Bug ID: 22184
           Summary: Incomplete cursor traversal: Lambda function param
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: contact at jeaye.com
                CC: klimek at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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: https://gist.github.com/jeaye/6e04855778086c1e5d24
the resulting output is currently (trunk as of 01-10-15):

https://gist.github.com/jeaye/78ae7c98156afc5dfa34

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:
https://github.com/jeaye/clang/commit/d5e32aa70903556a5181f45ee6b9975864b890ba
the result is:

https://gist.github.com/jeaye/81e5e58f3da3bf2334d8

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150110/751976c2/attachment.html>


More information about the llvm-bugs mailing list