rsmith added a comment.

Argyrios, I'd appreciate your thoughts here.


================
Comment at: tools/libclang/CIndex.cpp:6670-6694
@@ -6669,1 +6669,27 @@
 
+bool clang_Cursor_hasLocalStorage(CXCursor C) {
+  if (C.kind != CXCursor_VarDecl) {
+    return false;
+  }
+
+  const Decl *D = getCursorDecl(C);
+  if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
+    return VD->hasLocalStorage();
+  }
+
+  return false;
+}
+
+bool clang_Cursor_isStaticLocal(CXCursor C) {
+  if (C.kind != CXCursor_VarDecl) {
+    return false;
+  }
+
+  const Decl *D = getCursorDecl(C);
+  if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
+    return VD->isStaticLocal();
+  }
+
+  return false;
+}
+
----------------
I don't think the names of these are really specific enough for what they do. 
As members of `VarDecl`, they're good enough, but as operations on a general 
`Cursor`, it's less so. For instance, temporary objects in C++ might also have 
local storage or be static locals. Renaming `isStaticLocal` to 
`isStaticLocalVar` would help.

`hasLocalStorage` is not really a very user-friendly name for this 
functionality, even though it currently matches our C++ API (the C API has 
long-term stability guarantees whereas the C++ API does not, so we need to take 
more care when naming C API functions, even though matching the C++ API does 
generally make the C API more user-friendly). `isStaticLocalVar` versus 
`isNonStaticLocalVar` might be better if you don't want to go the enum route.


http://reviews.llvm.org/D10834



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to