[clang] [clang] Implement statement printer for EmbedExpr (PR #117770)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 08:27:40 PST 2024


================
@@ -3902,6 +3902,8 @@ void Preprocessor::HandleEmbedDirectiveImpl(
   }
 
   EmbedAnnotationData *Data = new (BP) EmbedAnnotationData;
+  Data->Filename = Filename;
+  Data->IsAngled = IsAngled;
   Data->BinaryData = BinaryContents;
----------------
AaronBallman wrote:

I think the way this may need to work is to find out where we're getting the file name from and seeing how long-lived that string is. It's passed here as a `StringRef`, and it would nice if we can store it as a `StringRef` in the `EmbedAnnotationData` rather than as a `std::string`. My guess is that the name comes from the `FileManager` and is as long-lived as the `SourceManager` which is owned by `ASTContext`, but we'd need to verify that.

https://github.com/llvm/llvm-project/pull/117770


More information about the cfe-commits mailing list