[PATCH] D10834: Added functions to retrieve information about variable storage in libclang and its python bindings.

guibufolo+llvm@gmail.com via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 11 20:54:57 PDT 2015


RedX2501 added inline comments.

================
Comment at: include/clang-c/Index.h:3815-3823
@@ -3814,2 +3814,11 @@
 
 /**
+ * \brief Returns true if a variable with function scope is a non-static local variable.
+ */
+CINDEX_LINKAGE bool clang_Cursor_hasLocalStorage(CXCursor C);
+
+/*
+ * \brief  Returns true if a variable with function scope is a static local variable.
+ */
+CINDEX_LINKAGE bool clang_Cursor_isStaticLocal(CXCursor C);
+
----------------
rsmith wrote:
> It might be better to combine these into a single function (`getLocalVarKind`?) returning an enum { not local, non-static local, static local }.
Combining these into one function with an enum is much more work when porting to python (which is also den in this patch). Therefore unless there are reasons beyond stylistic ones i'd prefer to keep them separate.

IMHO this also increases the friendliness as you can directly infer from the documentation at http://clang.llvm.org/doxygen/ what they should do as they just forward the calls..


http://reviews.llvm.org/D10834





More information about the cfe-commits mailing list