Resolve enums used in parameter default values to their fully-qualified name.

Authored by burel on Oct 21 2015, 9:15 PM.

Description

Resolve enums used in parameter default values to their fully-qualified name.

For example:

class QTextCodec {

enum ConversionFlag {
    DefaultConversion,
    IgnoreHeader = 0x1,
    FreeFunction = 0x2
};

struct ConverterState {
    ConverterState(ConversionFlag f = DefaultConversion);
};

};
In the above constructor for ConverterState, clang will identify the default
argument for the constructor as the string as written, "DefaultConversion".
However, when smoke generates bindings for that struct outside of the
QTextCodec base class, so looking up DefaultConversion will fail. It needs
to be fully qualified as QTextCodec::DefaultArgVisitor.

This RecursiveASTVisitor is used to walk the default expression used for a
parameter, and resolve enums to their fully-qualified versions. It only
supports "simple" expressions, ie, expressions that really only contain a
reference to the enum itself. Any fancier default value, such as
Qt::Flags(IgnoreHeader|FreeFunction) are not supported.

Details

Committed
burelNov 25 2015, 4:16 PM
Parents
R521:0a353b280a22: Add files from template arguments to the includes list.
Branches
Unknown
Tags
Unknown