From 99d1b295031ea4e74630914c14f94d919aa8e8dc Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 1 Oct 2016 16:38:28 +0000 Subject: Use StringRef for MemoryBuffer identifier API (NFC) llvm-svn: 283043 --- llvm/lib/Support/MemoryBuffer.cpp | 10 +++++----- llvm/lib/Support/SourceMgr.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index b935cbf1ae7..689343206c5 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -90,9 +90,9 @@ public: /// tail-allocated data. void operator delete(void *p) { ::operator delete(p); } - const char *getBufferIdentifier() const override { - // The name is stored after the class itself. - return reinterpret_cast(this + 1); + StringRef getBufferIdentifier() const override { + // The name is stored after the class itself. + return StringRef(reinterpret_cast(this + 1)); } BufferKind getBufferKind() const override { @@ -221,9 +221,9 @@ public: /// tail-allocated data. void operator delete(void *p) { ::operator delete(p); } - const char *getBufferIdentifier() const override { + StringRef getBufferIdentifier() const override { // The name is stored after the class itself. - return reinterpret_cast(this + 1); + return StringRef(reinterpret_cast(this + 1)); } BufferKind getBufferKind() const override { diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp index b2f87d64845..4cb9b2ff2cd 100644 --- a/llvm/lib/Support/SourceMgr.cpp +++ b/llvm/lib/Support/SourceMgr.cpp @@ -142,7 +142,7 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind, // location to pull out the source line. SmallVector, 4> ColRanges; std::pair LineAndCol; - const char *BufferID = ""; + StringRef BufferID = ""; std::string LineStr; if (Loc.isValid()) { -- cgit v1.2.3