From: Nico Weber Date: Thu, 4 Apr 2019 21:06:41 +0000 (+0000) Subject: Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer* X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fb0089d3d9355e215f427a46d3a5ae25dc066b8;p=llvm Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer* Requires making the llvm::MemoryBuffer* stored by SourceManager const, which in turn requires making the accessors for that return const llvm::MemoryBuffer*s and updating all call sites. The original motivation for this was to use it and fix the TODO in CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag version of createFileID, and since llvm::SourceMgr* hands out a const llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO this way actually works, but this seems like a good change on its own anyways. No intended behavior change. Differential Revision: https://reviews.llvm.org/D60247 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357724 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index 44052697d06..fc327d2fbd7 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -264,7 +264,7 @@ class MemoryBufferRef { public: MemoryBufferRef() = default; - MemoryBufferRef(MemoryBuffer& Buffer) + MemoryBufferRef(const MemoryBuffer& Buffer) : Buffer(Buffer.getBuffer()), Identifier(Buffer.getBufferIdentifier()) {} MemoryBufferRef(StringRef Buffer, StringRef Identifier) : Buffer(Buffer), Identifier(Identifier) {}