Skip to content

Commit 6df557b

Browse files
authored
Fix getBitWidthValue compilation error on LLVM 20+ (#1248)
* Fixes #1242. Introduced by upstream in llvm/llvm-project#122289 Ref: iovisor/bcc#5194
2 parents b201e40 + bc656a7 commit 6df557b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

c2rust-ast-exporter/src/AstExporter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,8 +2213,12 @@ class TranslateASTVisitor final
22132213

22142214
// 2. Encode bitfield width if any
22152215
if (D->isBitField()) {
2216-
cbor_encode_uint(
2217-
array, D->getBitWidthValue(*this->Context));
2216+
#if LLVM_VERSION_MAJOR >= 20
2217+
const auto bitWidthValue = D->getBitWidthValue();
2218+
#else
2219+
const auto bitWidthValue = D->getBitWidthValue(*this->Context);
2220+
#endif
2221+
cbor_encode_uint(array, bitWidthValue);
22182222
} else {
22192223
cbor_encode_null(array);
22202224
};

0 commit comments

Comments
 (0)