[all-commits] [llvm/llvm-project] 48fb66: [libclang] No longer attempt to get a dependent bi...

Collin Baker via All-commits all-commits at lists.llvm.org
Tue Mar 14 06:59:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 48fb6659610a3177e8606681046dfa0d19f67203
      https://github.com/llvm/llvm-project/commit/48fb6659610a3177e8606681046dfa0d19f67203
  Author: Collin Baker <collinbaker at chromium.org>
  Date:   2023-03-14 (Tue, 14 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang-c/Index.h
    M clang/tools/libclang/CXType.cpp

  Log Message:
  -----------
  [libclang] No longer attempt to get a dependent bit-width

Handle template parameter-dependent bit field widths in libclang

In a class template, a bit field's width may depend on a template
parameter. In this case the width expression cannot be evaluated.

Previously clang_getFieldDeclBitWidth() would assert, or cause memory
unsafety and return an invalid result if assertions are disabled.

This adds a check for this case which returns an error code.

This work was largely taken from an earlier patch which was reverted
due to an accidental API duplication
(https://reviews.llvm.org/D130303).

Fixes: https://github.com/llvm/llvm-project/issues/56644
Co-authored-by: Aaron Ballman <aaron at aaronballman.com>
Differential Revision: https://reviews.llvm.org/D146039




More information about the All-commits mailing list