>  /**
> + * \brief Retrieve an integer value from a CXCursor (if any).
> + *
> + * For example, this can be used to:
> + *
> + * * Get the value of an enumeration constant.
> + * * Get the value of a currently unexposed declaration attribute
> + *   (for example, inline or calling convention attributes).
> + * * Get the value of an initializer or bit field width
> + *   from a currently unexposed expression.
> + */
> +CINDEX_LINKAGE int clang_getCursorValue(CXCursor C);
> +


Merging unrelated functionality in one function does not seem ideal.

How about:
-actually expose the attributes that you are interested in
-adding clang_getConstantValue(CXCursor) where CXCursor can be a decl with an 
init value (like CXCursor_EnumConstantDecl) or a constant-folded expression.
-adding clang_getBitfieldWidth(CXCursor) where CXCursor is a FieldDecl 
(separate function otherwise there may be some difficulty distinguishing 
between a bitfield width and an in-class initializer)

-Argyrios

On Sep 15, 2011, at 5:54 AM, Vinay Sajip wrote:

> I've attached a patch to allow getting useful integer values from a cursor, 
> such as
> 
> An enumeration constant value
> 
> An unexposed declaration attribute (e.g. inline)
> An unexposed expression (e.g. a bit field width)
> 
> Comments welcome.
> 
> Regards,
> 
> Vinay Sajip
> <cursor-value.diff>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to