[llvm-bugs] [Bug 39739] New: traversal a COMPOUND_STMT return false number of children

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 21 00:41:12 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39739

            Bug ID: 39739
           Summary: traversal a COMPOUND_STMT return false number of
                    children
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: abc19899 at foxmail.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 21137
  --> https://bugs.llvm.org/attachment.cgi?id=21137&action=edit
python code

I am using libclang's pythong binding to parse C++ source.
consider these C++11 code:

  1 #include <vector>
  2 #include <iostream>
  3 
  4 int main()
  5 {
  6   std::vector<int> vi = {1, 2, 3, 4};
  7   for(auto &&i: vi)
  8   {
  9     std::cout << i << std::endl;
 10   }
 11 }
 12 

I can find a cursor type(CursorKind.COMPOUND_STMT) start(<SourceLocation file
'test_code.cpp', line 5, column 1>) end(<SourceLocation file 'test_code.cpp',
line 11, column 2>)
but if i can get_children, it returns only one cursor
type(CursorKind.DECL_STMT) start(<SourceLocation file 'test_code.cpp', line 6,
column 2>) end(<SourceLocation file 'test_code.cpp', line 6, column 37>)
there should be more children located from line 7 to 10.

the python code is in attachment and it's running in python3.5

-- 
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/20181121/656ec2fc/attachment.html>


More information about the llvm-bugs mailing list