[PATCH] D130303: Fix include order in CXType.cpp
Igor Kushnir via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 00:04:02 PDT 2023
vedgy added inline comments.
================
Comment at: clang/tools/libclang/CXType.cpp:374
+unsigned clang_isBitFieldDecl(CXCursor C) {
+ using namespace cxcursor;
----------------
vedgy wrote:
> I just noticed the `clang_Cursor_isBitField()` function implemented [[ https://github.com/llvm/llvm-project/commit/e822f58db4dee2ae56e306512288224979b9b5ba | 10 years ago ]] , which returns exactly the same value as this new function. So most changes in this commit can be reverted.
`clang_Cursor_isBitField()` is declared much later in //Index.h// and isn't easily discoverable. `clang_getFieldDeclBitWidth()` could benefit from a usage example. Here is how I plan to use it in KDevelop:
```
if (clang_Cursor_isBitField(cursor)) {
const auto bitWidth = clang_getFieldDeclBitWidth(cursor);
decl->setBitWidth(bitWidth == -1 ? ClassMemberDeclaration::ValueDependentBitWidth : bitWidth);
}
```
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