[cfe-commits] [PATCH] libclang: Exposing more statement, expression and declaration types.

Douglas Gregor dgregor at apple.com
Wed Sep 28 22:59:07 PDT 2011


Hello,

On Sep 28, 2011, at 7:38 AM, Holtgrewe, Manuel wrote:

> Dear all,
> 
> attached is a patch that exposes more statement, expression and declaration types through libclang. Also, I updated the Python bindings for these changes.
> 
> I have previously sent a patch but that has been overlooked so far. Thus, I resubmit another patch, this time with [PATCH] in the subject and hope that the missing [PATCH] was the reason  for why it was overlooked. If there are other requirements to be met before submitting patches then please tell me so.


Sorry I missed your first patch; traffic has been very high recently. Thanks for working on this!

The libclang API intentionally avoids exposing all of the expression kinds, because we want to be able to refactor Clang's internal representation freely without breaking the libclang API. So, it's fine to expose more cursor kinds for cursors that map unambiguously to a particular language element---say, an integer literal or a C++ "new" expression---but not to expose internal details (expression-with-cleanups, type trait expressions). A sampling of cursor kinds that I think should *not* be exposed: CXCursor_OffsetOfExpr, CXCursor_UnaryExprOrTypeTraitExpr, CXCursor_BinaryConditionalOperator, CXCursor_ImplicitCastExpr (debatable!), CXCursor_ImplicitValueInitExpr, CXCursor_ParenListExpr, CXCursor_ChooseExpr, CXCursor_CXXUuidofExpr, CXCursor_CXXDefaultArgExpr, CXCursor_CXXScalarValueInitExpr, CXCursor_UnresolvedLookupExpr (I'd rather it just be a declaration reference with no backing declaration), CXCursor_UnaryTypeTraitExpr, CXCursor_BinaryTypeTraitExpr, CXCursor_ArrayTypeTraitExpr, CXCursor_ExpressionTraitExpr, CXCursor_DependentScopeDeclRefExpr (same comment as for CXCursor_UnresolvedLookupExpr), CXCursor_CXXBindTemporaryExpr, CXCursor_ExprWithCleanups, CXCursor_CXXUnresolvedConstructExpr (one general "construct an object" expression would be better), CXCursor_CXXDependentScopeMemberExpr (just a member expression), CXCursor_UnresolvedMemberExpr (just a member expression), CXCursor_CXXNoexceptExpr (just a unary expression?), CXCursor_ObjCIsaExpr (just a member expression), CXCursor_ObjCIndirectCopyRestoreExpr, CXCursor_ShuffleVectorExpr, CXCursor_OpaqueValueExpr, CXCursor_AsTypeExpr, CXCursor_MaterializeTemporaryExpr.


Comment is wrong here:

+  /** \brief C++'s try statement.
+   */
+  CXCursor_SEHTryStmt                    = 226,



	- Doug



More information about the cfe-commits mailing list