[clang] [InstallAPI] Use unique identifiers for input buffers (PR #83523)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 29 21:11:36 PST 2024


https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/83523

None

>From 82521efd33c253b34da149b5dfe6bbb7823589c1 Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Thu, 29 Feb 2024 21:04:58 -0800
Subject: [PATCH] [InstallAPI] Use unique name for input buffers

---
 clang/lib/InstallAPI/Frontend.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/InstallAPI/Frontend.cpp b/clang/lib/InstallAPI/Frontend.cpp
index 9f675ef7d1bd22..133e49230ffa9b 100644
--- a/clang/lib/InstallAPI/Frontend.cpp
+++ b/clang/lib/InstallAPI/Frontend.cpp
@@ -51,8 +51,10 @@ std::unique_ptr<MemoryBuffer> createInputBuffer(const InstallAPIContext &Ctx) {
   if (Contents.empty())
     return nullptr;
 
-  return llvm::MemoryBuffer::getMemBufferCopy(
-      Contents, "installapi-includes" + getFileExtension(Ctx.LangMode));
+  SmallString<64> BufferName(
+      {"installapi-includes-", Ctx.Slice->getTriple().str(), "-",
+       getName(Ctx.Type), getFileExtension(Ctx.LangMode)});
+  return llvm::MemoryBuffer::getMemBufferCopy(Contents, BufferName);
 }
 
 } // namespace clang::installapi



More information about the cfe-commits mailing list