1

Suppose I have the variable definition int x = MACRO(5) /* HOHO */ + 25; and have access to x's CXCursor in libclang. I want to get the definition without the additional spaces and without the comment. I know how to get the extents of the cursor, but suppose I use the obtained start/end locations to obtain the definition string from the source file, does (lib)clang have any helper function for removing comments? I can write one myself (does not seem to be that hard), but thought maybe there already exists one.

EDIT: Actually, it may actually be quite hard to write one myself.. one thing I forgot is that I also have to take strings into account: char* str = "\* abcde " \* comment */;

PhantomR
  • 605
  • 4
  • 16

0 Answers0