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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to