[PATCH] D95514: [clang][cli] Teach CompilerInvocation to allocate strings on its own

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 08:35:02 PST 2021


jansvoboda11 added inline comments.


================
Comment at: clang/include/clang/Frontend/CompilerInvocation.h:144
+  /// Container holding strings allocated during round-trip.
+  mutable std::forward_list<std::string> AllocatedStrings;
+
----------------
dexonsmith wrote:
> I suggest using llvm::StringPool instead, which also uniques the strings and is used elsewhere for this kind of thing. Probably in an Optional to make it more clear it’s not always used.
> 
> Maybe the name RoundTrippedStrings? 
>From the documentation of `StringPool`, it seems like we would need to store `PooledStringPtr`s in order to keep them alive. How would that work with the `const char *` API we have?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95514/new/

https://reviews.llvm.org/D95514



More information about the cfe-commits mailing list