You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Experimenting with it demonstrated, that libclang provides deeper lexical fidelity when parsing a C source/header file (i.e. it provides preprocessor tokens before they're expanded). Perhaps this can be used to more effectively work around __asm__(...)-statements, which make direct inclusion of that particular file impossible.
The text was updated successfully, but these errors were encountered:
Not that some_func is defined directly within the header file. Note also that __asm__("bkpt"); is not a valid x86(_64) instruction. The compiler will therefore refuse compilation, even ifsome_func is cleverly knocked out through the workaround stated in In-Header Defined Functions.
The only solution I see is to abandon the "wrapping" philosophy and resort to "banning" the original header. Utilizing libclangs deeper lexical offerings we might be able to "copy" a slimmed down version of the original header and kick out such in-header definitions, while keeping declarations and inclusions intact.
Unfortunately, the same can not be done for illegal instructions inside C macros. Without expanding such a macro in the appropriate context, nobody can tell what its contents mean (they could be virtually anything, so reliably parsing it is effectively impossible). Some more thinking required...
As discussed in #3 (comment), explore possibilities of using libclang's C API. Fortunately, libclang provides Python bindings for their C API.
Experimenting with it demonstrated, that libclang provides deeper lexical fidelity when parsing a C source/header file (i.e. it provides preprocessor tokens before they're expanded). Perhaps this can be used to more effectively work around
__asm__(...)
-statements, which make direct inclusion of that particular file impossible.The text was updated successfully, but these errors were encountered: