Skip to content

Commit

Permalink
DELETE ME: test / debugging helper files, etc.
Browse files Browse the repository at this point in the history
Literal landfill...
  • Loading branch information
BrunoMSantos committed Nov 16, 2023
1 parent 4219201 commit 92c4f36
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespaces
using
lambdas
friend
49 changes: 49 additions & 0 deletions doc/cpp-testing.rst
Original file line number Diff line number Diff line change
@@ -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<MySpecificEnum>::type
..
.. A scoped enum with non-default visibility, and with a specified underlying
.. type.
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Contents:
extending
built-in-extensions
troubleshooting
cpp-testing

Indices and tables
==================
Expand Down
29 changes: 29 additions & 0 deletions dump_tokens.py
Original file line number Diff line number Diff line change
@@ -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())

0 comments on commit 92c4f36

Please sign in to comment.