Author: Aaron Ballman Date: 2023-03-14T08:57:25-04:00 New Revision: 20fb4c3270b9d3596f213623d39c507711d1c165
URL: https://github.com/llvm/llvm-project/commit/20fb4c3270b9d3596f213623d39c507711d1c165 DIFF: https://github.com/llvm/llvm-project/commit/20fb4c3270b9d3596f213623d39c507711d1c165.diff LOG: Revert "Fix include order in CXType.cpp" This reverts commit 4d55a0b512a17dfaa2461b8803d37b79f6c9691d. The addition of clang_isBitFieldDecl is not needed because clang_Cursor_isBitField already exists. Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang-c/Index.h clang/tools/libclang/CXType.cpp clang/tools/libclang/libclang.map Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b466dfc5b84b0..cfec4ed96ad9b 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -306,11 +306,6 @@ libclang - Introduced the new function ``clang_CXXMethod_isExplicit``, which identifies whether a constructor or conversion function cursor was marked with the explicit identifier. -- Added check in ``clang_getFieldDeclBitWidth`` for whether a bit field - has an evaluable bit width. Fixes undefined behavior when called on a - bit field whose width depends on a template paramter. -- Added function ``clang_isBitFieldDecl`` to check if a struct/class field is a - bit field. - Introduced the new ``CXIndex`` constructor function ``clang_createIndexWithOptions``, which allows overriding precompiled preamble diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 5f71b86b20b48..bc9e100846be6 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -3028,18 +3028,10 @@ CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); -/** - * Returns non-zero if a field declaration has a bit width expression. - * - * If the cursor does not reference a bit field declaration 0 is returned. - */ -CINDEX_LINKAGE unsigned clang_isBitFieldDecl(CXCursor C); - /** * Retrieve the bit width of a bit field declaration as an integer. * - * If the cursor does not reference a bit field, or if the bit field's width - * expression cannot be evaluated, -1 is returned. + * If a cursor that is not a bit field declaration is passed in, -1 is returned. */ CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); diff --git a/clang/tools/libclang/CXType.cpp b/clang/tools/libclang/CXType.cpp index 9358e3e5f14e5..a1d157c63995b 100644 --- a/clang/tools/libclang/CXType.cpp +++ b/clang/tools/libclang/CXType.cpp @@ -10,11 +10,11 @@ // //===--------------------------------------------------------------------===// -#include "CXType.h" #include "CIndexer.h" #include "CXCursor.h" #include "CXString.h" #include "CXTranslationUnit.h" +#include "CXType.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" @@ -371,27 +371,14 @@ unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C) { return ULLONG_MAX; } -unsigned clang_isBitFieldDecl(CXCursor C) { - using namespace cxcursor; - - if (clang_isDeclaration(C.kind)) { - const Decl *D = getCursorDecl(C); - - if (const auto *FD = dyn_cast_or_null<FieldDecl>(D)) - return FD->isBitField(); - } - - return 0; -} - int clang_getFieldDeclBitWidth(CXCursor C) { using namespace cxcursor; if (clang_isDeclaration(C.kind)) { const Decl *D = getCursorDecl(C); - if (const auto *FD = dyn_cast_or_null<FieldDecl>(D)) { - if (FD->isBitField() && !FD->getBitWidth()->isValueDependent()) + if (const FieldDecl *FD = dyn_cast_or_null<FieldDecl>(D)) { + if (FD->isBitField()) return FD->getBitWidthValue(getCursorContext(C)); } } diff --git a/clang/tools/libclang/libclang.map b/clang/tools/libclang/libclang.map index f6cc157d7fb83..34b1ef1a54514 100644 --- a/clang/tools/libclang/libclang.map +++ b/clang/tools/libclang/libclang.map @@ -422,7 +422,6 @@ LLVM_17 { global: clang_CXXMethod_isExplicit; clang_createIndexWithOptions; - clang_isBitFieldDecl; }; # Example of how to add a new symbol version entry. If you do add a new symbol _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits