Fix comma in attributes on enum value

This commit is contained in:
Jonathan Müller 2017-11-10 13:07:22 +01:00
commit ced136a3a4

View file

@ -266,12 +266,12 @@ namespace
while (!token_after_is(tu, file, cur, end, ";")) while (!token_after_is(tu, file, cur, end, ";"))
end = get_next_location(tu, file, end); end = get_next_location(tu, file, end);
} }
else if (kind == CXCursor_EnumConstantDecl && !token_after_is(tu, file, cur, end, ",") else if (kind == CXCursor_EnumConstantDecl && !token_after_is(tu, file, cur, end, ","))
&& !token_after_is(tu, file, cur, end, ";"))
{ {
while (!token_after_is(tu, file, cur, end, ",") // need to support attributes
&& !token_after_is(tu, file, cur, end, ";")) // just give up and extend the range to the range of the entire enum...
end = get_next_location(tu, file, end); auto parent = clang_getCursorLexicalParent(cur);
end = clang_getRangeEnd(clang_getCursorExtent(parent));
} }
else if (kind == CXCursor_FieldDecl || kind == CXCursor_ParmDecl else if (kind == CXCursor_FieldDecl || kind == CXCursor_ParmDecl
|| kind == CXCursor_NonTypeTemplateParameter || kind == CXCursor_NonTypeTemplateParameter