================
@@ -2382,14 +2382,20 @@ size_t SourceManager::getDataStructureSizes() const {
SourceManagerForFile::SourceManagerForFile(StringRef FileName,
StringRef Content) {
+ // We copy to `std::string` for Context instead of StringRef because the
+ // SourceManager::getBufferData() works only with null-terminated buffers.
+ // And we still want to keep the API convenient.
+ ContentBuffer = Content.str();
----------------
ilya-biryukov wrote:
> I mainly think about my battery, when I code while being mobile.
But this extra copy is likely a really-really small portion of the reformatting
cost. Performance and battery go together here.
Is there anything I'm missing why it would not be the case?
https://github.com/llvm/llvm-project/pull/131299
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits