[all-commits] [llvm/llvm-project] 18a628: [AST] Use correct APSInt width when evaluating str...

Sergei Barannikov via All-commits all-commits at lists.llvm.org
Tue Sep 5 09:14:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 18a628ec4ef72bcc005e2e9d5757445c31c6e2f8
      https://github.com/llvm/llvm-project/commit/18a628ec4ef72bcc005e2e9d5757445c31c6e2f8
  Author: Sergei Barannikov <barannikov88 at gmail.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp

  Log Message:
  -----------
  [AST] Use correct APSInt width when evaluating string literals

The width of the APSInt values should be the width of an element.
getCharByteWidth returns the size of an element in _host_ bytes, which
makes the width N times greater, where N is the ratio between target's
CHAR_BIT and host's CHAR_BIT.
This is NFC for in-tree targets because all of them have CHAR_BIT == 8.

Reviewed By: cor3ntin, aaron.ballman

Differential Revision: https://reviews.llvm.org/D154773




More information about the All-commits mailing list