diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index 58a217f6c79..eb4784cbf58 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_MEMORYBUFFER_H #define LLVM_SUPPORT_MEMORYBUFFER_H +#include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include @@ -42,6 +43,10 @@ public: const char *getBufferEnd() const { return BufferEnd; } size_t getBufferSize() const { return BufferEnd-BufferStart; } + StringRef getBuffer() const { + return StringRef(BufferStart, getBufferSize()); + } + /// getBufferIdentifier - Return an identifier for this buffer, typically the /// filename it was read from. virtual const char *getBufferIdentifier() const {