[all-commits] [llvm/llvm-project] 2e7710: [clang] Introduce "binary" StringLiteral for #embe...

Mariya Podchishchaeva via All-commits all-commits at lists.llvm.org
Mon Apr 14 12:27:46 PDT 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e7710eaffddcbb6094e32826ec6e69bb4cb1799
      https://github.com/llvm/llvm-project/commit/2e7710eaffddcbb6094e32826ec6e69bb4cb1799
  Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M clang/include/clang/AST/Expr.h
    M clang/lib/AST/Expr.cpp
    M clang/lib/Parse/ParseInit.cpp
    M clang/lib/Sema/SemaInit.cpp
    A clang/test/Preprocessor/embed_constexpr.c

  Log Message:
  -----------
  [clang] Introduce "binary" StringLiteral for #embed data (#127629)

StringLiteral is used as internal data of EmbedExpr and we directly use
it as an initializer if a single EmbedExpr appears in the initializer
list of a char array. It is fast and convenient, but it is causing
problems when string literal character values are checked because #embed
data values are within a range [0-2^(char width)] but ordinary
StringLiteral is of maybe signed char type.
This PR introduces new kind of StringLiteral to hold binary data coming
from an embedded resource to mitigate these problems. The new kind of
StringLiteral is not assumed to have signed char type. The new kind of
StringLiteral also helps to prevent crashes when trying to find
StringLiteral token locations since these simply do not exist for binary
data.

Fixes https://github.com/llvm/llvm-project/issues/119256


  Commit: 7034995f102967c6f28c2d7d04913608853050ac
      https://github.com/llvm/llvm-project/commit/7034995f102967c6f28c2d7d04913608853050ac
  Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    M clang/lib/Sema/SemaExprCXX.cpp

  Log Message:
  -----------
  [clang] Handle Binary StingLiteral kind in one more place (#132201)

The bots are upset by https://github.com/llvm/llvm-project/pull/127629 .
Fix that.


Compare: https://github.com/llvm/llvm-project/compare/e0db588f3db4...7034995f1029

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list