OSDN Git Service

[NFC] Change Key in Argument to a std::string
authorJessica Paquette <jpaquette@apple.com>
Thu, 31 Aug 2017 20:47:37 +0000 (20:47 +0000)
committerJessica Paquette <jpaquette@apple.com>
Thu, 31 Aug 2017 20:47:37 +0000 (20:47 +0000)
commit70b69dcc759f35d81fd95c025d35844f74e16180
tree18697c0b0e4124b0a1da273cdbc9dcba43671571
parentae734ae0eada22cb4fcef3d18035a9725f5532da
[NFC] Change Key in Argument to a std::string

Before, Key was a StringRef to avoid unnecessary copies. This commit changes
that to a std::string.

This was okay previously because when people called emit for remarks before,
they would create the remark *within* the call to emit. However, if you build
the remark up and call emit *afterward*, it's possible to end up freeing the
memory assigned to the StringRef before the call to emit.

This caused a test failure with https://reviews.llvm.org/D37085 on Linux.
Since building remarks before a call to emit is a valid use-case, it makes
sense to replace this with a std::string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312277 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/DiagnosticInfo.h