Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ #95802

Merged
merged 7 commits into from
Jun 20, 2024

Commits on Jun 17, 2024

  1. Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++

    This commit implements the entirety of the now-accepted [N3017 -
    Preprocessor
    Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
    its sister C++ paper [p1967](https://wg21.link/p1967). It implements
    everything in the specification, and includes an implementation that
    drastically improves the time it takes to embed data in specific
    scenarios (the initialization of character type arrays). The mechanisms
    used to do this are used under the "as-if" rule, and in general when the
    system cannot detect it is initializing an array object in a variable
    declaration, will generate EmbedExpr AST node which will be expanded
    by AST consumers (CodeGen or constant expression evaluators) or
    expand embed directive as a comma expression.
    
    This reverts commit 682d461.
    
    ---------
    
    Co-authored-by: The Phantom Derpstorm <phdofthehouse@gmail.com>
    Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
    Co-authored-by: cor3ntin <corentinjabot@gmail.com>
    Co-authored-by: H. Vetinari <h.vetinari@gmx.com>
    5 people committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    d8af444 View commit details
    Browse the repository at this point in the history
  2. Fix memory leak caused by EmbedAnnotationData

    Memory was allocated by a bump allocator. EmbedAnnotationData
    had a SmallString inside that can grow.
    This commit fixes memory leak by removing filename fields from
    EmbedAnnotationData and EmbedExpr itself since it wasn't used anyway.
    Fznamznon committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    eb33e45 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7cf9a9a View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2024

  1. Avoid null byte file

    Fznamznon committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    843a3db View commit details
    Browse the repository at this point in the history
  2. Fix alignment

    Fznamznon committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    a5081b4 View commit details
    Browse the repository at this point in the history
  3. Use report_fatal_error

    Fznamznon committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    8dc7026 View commit details
    Browse the repository at this point in the history
  4. Add "weird" test cases

    Fznamznon committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    52b504a View commit details
    Browse the repository at this point in the history