https://bugs.kde.org/show_bug.cgi?id=374801

--- Comment #9 from Stephen Kelly <steve...@gmail.com> ---
Superb, thanks for reducing it to that. Now let's see if we can get a reduced
testcase showing it is an upstream bug somehow.

Please create a file called clang-param-test.h containing

 enum MyFlagType {
     EnumValueOne = 0x01,
     EnumValueTwo = 0x02
 };

 void useEnum(int foo = 100, uint flags = EnumValueOne);

and a clang-param-test.py containing

 #!/usr/bin/env python

 from __future__ import print_function

 import sys

 from clang import cindex
 from clang.cindex import CursorKind, SourceRange

 my_clang_library = "/usr/lib/x86_64-linux-gnu/libclang-3.8.so"

 my_source = "clang-param-test.h"

 if (len(sys.argv) > 1 and sys.argv[1] == "use14"):
     cxx_standard_flag = ["-std=gnu++14"]
     print("using", cxx_standard_flag)
 else:
     print("using default flag")
     cxx_standard_flag = []

 cindex.Config.set_library_file(my_clang_library)

 index = cindex.Index.create() 
 tu = index.parse(my_source, ["-x", "c++"] + cxx_standard_flag)

 for member in tu.cursor.get_children():
     if (member.spelling == "useEnum"):
         for child in member.get_children():
             if child.kind == CursorKind.PARM_DECL:
                 for parameter in child.get_children():
                     if parameter.kind.is_expression():
                         possible_extent =
SourceRange.from_locations(parameter.extent.start, member.extent.end)
                         print(possible_extent)


and then run 

 python2 clang-param-test.py
 python2 clang-param-test.py use14

I guess you will get different output for each time you run it. I get the same
output.

Please also say your python version and libclang version.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to