summaryrefslogtreecommitdiff
path: root/clang/test/Preprocessor/embed_weird.cpp
AgeCommit message (Collapse)Author
2025-04-17[clang] Implement StmtPrinter for EmbedExpr (#135957)Mariya Podchishchaeva
Tries to avoid memory leaks previously caused by saving filename by allocating memory in the preprocessor. Fixes https://github.com/llvm/llvm-project/issues/132641 Fixes https://github.com/llvm/llvm-project/issues/107869 --------- Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-07-31[Clang][Interp] Fix the location of uninitialized base warning (#100761)yronglin
Fix the location of `diag::note_constexpr_uninitialized_base`, make it same as current interpreter. This PR does not print type name with namespacethat was used to improve the current interpreter's type dump of base class type. --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-07-22[clang] Fix assertion failure in `injectEmbedTokens` (#99624)Mariya Podchishchaeva
It seems for C++ lexer has some caching ability which doesn't expect injecting "new" tokens in the middle of the cache. Technically #embed tokens are not completely new since they have already been read from the file and there was #embed annotation token in this place, so set `reinject` flag for them to silence assertion.
2024-07-19[clang] Fix underlying type of EmbedExpr (#99050)Mariya Podchishchaeva
This patch makes remaining cases of #embed to emit int type since there is an agreement to do that for C. C++ is being discussed, but in general we don't want to produce different types for C and C++.
2024-07-16[clang] Inject tokens containing #embed back into token stream (#97274)Mariya Podchishchaeva
Instead of playing "whack a mole" with places where #embed should be expanded as comma-separated list, just inject each byte as a token back into the stream, separated by commas.
2024-06-25[clang][test] Avoid writing to a potentially write-protected dir (#96457)Karl-Johan Karlsson
The test clang/test/Preprocessor/embed_weird.cpp creates a file directly in the Inputs dir in the llvm-project repo instead of the temporary directory. The llvm-project repo may be write protected e.g. in a sandboxed environment. This patch creates a separate temporary directory where the null_byte.bin file is created along with the rest of copies of the other embed-files needed for the testcase.
2024-06-20Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (#95802)Mariya Podchishchaeva
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 https://github.com/llvm/llvm-project/commit/682d461d5a231cee54d65910e6341769419a67d7. --------- 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>
2024-06-12Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C ↵Vitaly Buka
and Obj-C++ by-proxy)" (#95299) Reverts llvm/llvm-project#68620 Introduce or expose a memory leak and UB, see llvm/llvm-project#68620
2024-06-12[clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and ↵The Phantom Derpstorm
Obj-C++ by-proxy) (#68620) 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. --------- Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: H. Vetinari <h.vetinari@gmx.com> Co-authored-by: Podchishchaeva, Mariya <mariya.podchishchaeva@intel.com>