https://github.com/mmomtchev/cc-splitter
An experiment for making an automated C/C++ code splitter for SWIG generated output
https://github.com/mmomtchev/cc-splitter
Last synced: 5 months ago
JSON representation
An experiment for making an automated C/C++ code splitter for SWIG generated output
- Host: GitHub
- URL: https://github.com/mmomtchev/cc-splitter
- Owner: mmomtchev
- Created: 2023-08-01T17:12:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-02T08:21:18.000Z (about 2 years ago)
- Last Synced: 2025-02-17T15:17:13.519Z (8 months ago)
- Language: C++
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# This used to be an experiment in making an automated C/C++ code splitter for SWIG generated output
(but alas, this won't be practical if running after the preprocessor)
# Now it is the missing working tutorial for libclang
`splitter.cc` is the plumbing that allows you to create your plugin and to process the compiler options
`ast.cc` is the frontend plugin itself, `ASTSplitter::TraverseDecl` will get called for each compiler *declarator* (which is a declaration, a statement or a definition).This example will print all global declarations and definitions, discriminating between declaration and a definition, in a C++ source file.
```
./cc-splitter ~/src/node-magickwand/swig/Magick++.cxx -- -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/usr/include/node -I/usr/include/node/napi -I/home/mmom/src/node-magickwand/deps/ImageMagick/Magick++/lib -I/home/mmom/src/node-magickwand/deps/ImageMagick -c./cc-splitter ../splitter.cc -- -I/usr/lib/llvm-15/include/
./cc-splitter ../test.cc -- -I/usr/lib/llvm-15/include/
```