diff --git a/TODO b/TODO new file mode 100644 index 00000000..96fdc3b2 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +namespaces +using +lambdas +friend diff --git a/doc/cpp-testing.rst b/doc/cpp-testing.rst new file mode 100644 index 00000000..b42d2029 --- /dev/null +++ b/doc/cpp-testing.rst @@ -0,0 +1,49 @@ +C++ testing grounds +=================== + +Classes +------- + +.. cpp:autodoc:: ../cpp/class.cpp + +Structs +------- + +.. cpp:autodoc:: ../cpp/struct-class.cpp + +Enum class +---------- + +.. cpp:autodoc:: ../cpp/enum-class.cpp + +Templates +--------- + +.. cpp:autodoc:: ../cpp/template.cpp + :clang: --std=c++17 + +.. A link to a struct documentation from the docs :cpp:any:`stfoo`. +.. +.. .. cpp:autodoc:: test-cpp.cpp +.. +.. .. cpp:autovar:: fooer +.. :file: test-cpp.cpp +.. +.. .. cpp:autodoc:: enum.cpp +.. +.. .. cpp:enum:: MyEnum +.. +.. An unscoped enum. +.. +.. .. cpp:enum:: MySpecificEnum : long +.. +.. An unscoped enum with specified underlying type. +.. +.. .. cpp:enum-class:: MyScopedEnum +.. +.. A scoped enum. +.. +.. .. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type::type +.. +.. A scoped enum with non-default visibility, and with a specified underlying +.. type. diff --git a/doc/index.rst b/doc/index.rst index 406774d5..97fbdb54 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -47,6 +47,7 @@ Contents: extending built-in-extensions troubleshooting + cpp-testing Indices and tables ================== diff --git a/dump_tokens.py b/dump_tokens.py new file mode 100755 index 00000000..77027645 --- /dev/null +++ b/dump_tokens.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +import textwrap +from clang.cindex import Index, TranslationUnit, CursorKind + +index = Index.create() + +tu = index.parse(sys.argv[1], args=['-xc++'], + options=TranslationUnit.PARSE_CACHE_COMPLETION_RESULTS | + TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD | + TranslationUnit.PARSE_SKIP_FUNCTION_BODIES) + +for cursor in tu.cursor.get_children(): + print(cursor.kind) + print('\t', cursor.type.spelling, cursor.spelling) + + for c in cursor.get_children(): + print('\t', c.kind) + print('\t\t', c.type.spelling, c.spelling) + + print('\t\tconst:\t\t', c.is_const_method()) + print('\t\tpure virtual:\t', c.is_pure_virtual_method()) + print('\t\tvirtual:\t', c.is_virtual_method()) + print('\t\tstatic:\t\t', c.is_static_method()) + print('\t\tmutable:\t', c.is_mutable_field()) + print('\t\tscoped enum:\t', c.is_scoped_enum()) + print('\t\tanonymous:\t', c.is_anonymous()) +