Fix dangling reference to a local std::string.

Bug: 16031597

llvm::StringRefs are just lightweight wrappers around strings, and don't
retain/own any of the storage for the actual underlying string. This causes
lifetime issues if any local std::string objects that are then wrapped by
llvm::StringRef ever escape. When the local object goes out of scope, we are
left with a dangling reference.

Valgrind helped us to catch this happening for constant array exports, which
only ever use a statically named "<ConstantArray>" reference, so we can
simply replace it with static C string (wrapped by llvm::StringRef).

Change-Id: I0a9fae2687bc9f53d091d56cf15f99bb75ca46e4
2 files changed