Open Rubyfi opened 1 month ago
Apologies, I might have posted this in the wrong repo. I'm using the libclang module (latest) to use the parser.
Apparently, this behaviour occurs with other kinds of macros as well:
#define MIN(a, b) ((a) < (b) ? (a) : (b))
...
switch(Enum)
{
case Enum::Value1:
MIN(1,2);
break;
case Enum::Value2:
....
break;
...
}
and
#define ADD(a, b) (a + b)
...
switch(Enum)
{
case Enum::Value1:
ADD(1,2);
break;
case Enum::Value2:
....
break;
...
}
both show the same problem.
Hi, I'm trying to parse a set of swtich-case statements using the Python clang module and ran into some weird behavior. Given something like this:
Clang returns the assert statement's cursor kind as
CursorKind.CASE_STMT
. However, this only seems to happen when anassert
is the first statement in a case. Any other statements parse like expected. When another expression is placed first in thecase
, the cursor ofassert
isCursorKind.COMPOUND_STMT
instead:Am I misinterpreting the functionality of the underlying cursor; i.e. that it is supposed to help identifying the syntactical meaning of the according token; or is this a bug?