[PATCH] D130303: Fix include order in CXType.cpp
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 05:57:05 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/tools/libclang/CXType.cpp:374
+unsigned clang_isBitFieldDecl(CXCursor C) {
+ using namespace cxcursor;
----------------
vedgy wrote:
> 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);
> }
> ```
> I just noticed the clang_Cursor_isBitField() function implemented 10 years ago , which returns exactly the same value as this new function. So most changes in this commit can be reverted.
Wow, good catch!
I'm going to roll this commit back in its entirety rather than do a partial revert, then I'll push a new changes to add back the `isValueDependent()` bit below, and rearrange the header file + add an example.
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