rather than forcing the bump pointer allocator to produce a viable
pointer. This also fixes UB when we would try to memcpy from the null
incoming StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243947
91177308-0d34-0410-b5e6-
96231b3b80d8
}
static StringRef copyIntoContext(const ASTContext &C, StringRef str) {
+ if (str.empty())
+ return StringRef();
size_t size = str.size();
char *buffer = new (C) char[size];
memcpy(buffer, str.data(), size);