This is an archive of the discontinued LLVM Phabricator instance.

Added function to retrieve storage class in libclang.
ClosedPublic

Authored by RedX2501 on Sep 30 2014, 4:56 AM.

Details

Reviewers
RedX2501
Summary

Added function clang_getStorageClass(CXCursor) to be able to retrieve the storage class of function decls and variable decls.

Also added the corresponding interface to cindex.py.

Diff Detail

Event Timeline

RedX2501 updated this revision to Diff 14212.Sep 30 2014, 4:56 AM
RedX2501 retitled this revision from to Added function to retrieve storage class in libclang..
RedX2501 updated this object.
RedX2501 edited the test plan for this revision. (Show Details)
RedX2501 updated this revision to Diff 14213.Sep 30 2014, 4:59 AM
RedX2501 added a subscriber: Unknown Object (MLST).

Added cfe-commits as mailing list.

RedX2501 updated this revision to Diff 14279.Oct 1 2014, 6:22 AM

Added check for if getCursorDecl returns a valid object.

Hi, sorry for the delay!

+ /**
+ * \brief The storage class for functions and variables.
+ *
+ */
+ CXCursor_StorageClass = 51,
+

This doesn't need a new cursor kind, and I don't see this kind getting set for a cursor in your patch.

+CINDEX_LINKAGE enum CX_StorageClass clang_getStorageClass(CXCursor);

I suggest renaming to clang_Cursor_getStorageClass

Some style issues the make the code inconsistent with the rest of the codebase:

+ Decl const * D = getCursorDecl(C);
Change to "const Decl *D = .."
Same for similar cases later on.

+ if(D){
Space after 'if' and before the brace

+ }else{
Spaces between the braces.

+ switch(sc){
+ case SC_None :
Space after 'switch' and before brace, and 'case' should have same indentation as 'switch'.

RedX2501 updated this revision to Diff 14503.Oct 7 2014, 4:55 AM

Mady stylistic changes as recommended by Argyrios Kyrtzidis.
Added comments to C function.

Please also correct style in all places in clang_Cursor_getStorageClass, specifically

  • Put a space before the left braces
  • "const Decl * D" -> "const Decl *D" (note no space between star and variable)
  • "FunctionDecl const * FD" -> "const FunctionDecl *FD"
  • "VarDecl const * VD" -> "const VarDecl *VD"
RedX2501 updated this revision to Diff 14795.Oct 13 2014, 5:22 AM

Fixed raised style concerns.

Committed in r219809, thanks!

RedX2501 accepted this revision.Aug 10 2015, 1:11 AM
RedX2501 added a reviewer: RedX2501.

This was accepted into r219809.

This revision is now accepted and ready to land.Aug 10 2015, 1:11 AM
RedX2501 closed this revision.Aug 10 2015, 1:12 AM

Accepted into r219809.