[PATCH] D130303: Handle template parameter-dependent bit field widths in libclang

Igor Kushnir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 05:34:41 PST 2023


vedgy added inline comments.


================
Comment at: clang/include/clang-c/Index.h:3552
+ * If the cursor does not reference a bit field declaration or if the bit
+ * field's width does not depend on template parameters, 0 is returned.
+ */
----------------
I just thought how the new API could be used in KDevelop. Currently when `clang_getFieldDeclBitWidth()` is positive, e.g. 2, KDevelop shows  ` : 2` after the data member name in a tooltip. Ideally a template-param-dependent expression (actual code) would be displayed after the colon. If that's difficult to implement, `: [tparam-dependent]` or `: ?` could be displayed instead. But it would be more convenient and efficient to get this information by a single call to `clang_getFieldDeclBitWidth()` instead of calling `clang_isFieldDeclBitWidthDependent()` each time `clang_getFieldDeclBitWidth()` returns `-1`. So how about returning `-2` or `0` from `clang_getFieldDeclBitWidth()` instead of adding this new API?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130303/new/

https://reviews.llvm.org/D130303



More information about the cfe-commits mailing list