[clang] [clang] Implement statement printer for EmbedExpr (PR #117770)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 02:34:58 PST 2024
================
@@ -3902,6 +3902,8 @@ void Preprocessor::HandleEmbedDirectiveImpl(
}
EmbedAnnotationData *Data = new (BP) EmbedAnnotationData;
+ Data->Filename = Filename;
+ Data->IsAngled = IsAngled;
Data->BinaryData = BinaryContents;
----------------
Fznamznon wrote:
I struggle to see how the current implementation actually prevents the memory leak. `EmbedAnnotationData` is allocated first as if the `std::string` inside was empty, then the string is assigned with an array of chars which will likely extend string's size, giving no chance to deallocate proper size later. I wonder if keeping a `StringRef` in `EmbedAnnotationData` is possible instead.
https://github.com/llvm/llvm-project/pull/117770
More information about the cfe-commits
mailing list