Smattr / clink

a modern re-implementation of Cscope
The Unlicense
46 stars 2 forks source link

separate CPP #98

Closed Smattr closed 2 years ago

Smattr commented 2 years ago

We had to xfail some test cases like the undef one when transitioning back to a libclang-based parser. Libclang does not seem to give much information about macros, even when CXTranslationUnit_DetailedPreprocessingRecord is used. We should be able to work around this with our own very unsophisticated C preprocessor front end.

Smattr commented 2 years ago

Noting some further things that don't work as a fix to the macro-parent.c test case:

What does seem to be feasible is retrieving the range of a FunctionDecl which appears to cover the entire extent of a function, and then inferring that a macro expansion within that range has a parent of the function itself. This is tricky because (1) these two pieces of information are discovered in different phases and (2) the macro expansion is discovered before its parent. But I think this is doable.

Smattr commented 2 years ago

As of 512f59198bf6d0960115d1b82997a16baf628588, this is done.