Hi, nice patch.
NewFD->setVirtualAsWritten(true);
Do we need to set this on the method? According to the docs, this should
only be set if virtual was explicitly written in the code.
I don't know how else to set it. __interface implies all member
functions defined within are pure virtual, so one could say "as written"
fits the user writing "__interface" to get virtual functions. If there's
a better way to set virtual, I'll use it.
- if (!isDefinition || (NewTag != TTK_Class && NewTag != TTK_Struct))
- if (OldTag == NewTag)
- return true;
+ if (!isDefinition || !isClassCompatTagKind(NewTag) || OldTag == NewTag)
+ return true;
The behaviour of the code is changed here, though I'm not sure if that has
any impact on correctness.
It does - I must have not updated the patch after the last update I
made. In the later one this code is back to as it was except for adding
handling for __interface. [Oops. Grabbed the patch from the wrong
machine. Newer one is attached.]
+ default: assert("Invalid tag kind for field padding diagnostic!");
You used this assert message on a couple diagnostic index helper functions
which is incorrect for some. Seems to be a simple copy paste mismatch.
This is also taken care of in the attached update.
+ case TTK_Interface:
Out << 'U';
Did you confirm that cl mangles interfaces as structs?
Yes.
+ case TTK_Interface:
+ case TTK_Struct: return CXCursor_StructDecl;
I think we should add a new cursor in the C API, and not re-use
CXCursor_StructDecl for interfaces.
See previous message to list ("CXCursor value for __interface"): since
the cursor values are part of a public interface, I didn't think I could
change the values to insert an interface cursor; and there is no space
between CXCursor_LastDecl and CXCursor_FirstRef to add anything without
doing that. John McCall replied and said he thought using StructDecl was
fine.
__interface.patch (44.3 KB)