summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-19 21:12:39 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-19 21:12:39 +0000
commit09d689f90c745119a320c0808d775d5c60aaaade (patch)
tree7c7ac1b48cb13bc75a3f405eb2c60e3bb9c50771 /llvm/lib/IR
parent92045bc37c84ff6e4a819685879d062a57bc8b45 (diff)
downloadbcm5719-llvm-09d689f90c745119a320c0808d775d5c60aaaade.tar.gz
bcm5719-llvm-09d689f90c745119a320c0808d775d5c60aaaade.zip
Make it explicit that nulls are not allowed in names.
The object files we support use null terminated strings, so there is no way to support these. This patch adds an assert to catch bad API use and an error check in the .ll parser. llvm-svn: 195155
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Value.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 62a3b31c18b..2c90383edd8 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -182,6 +182,8 @@ void Value::setName(const Twine &NewName) {
SmallString<256> NameData;
StringRef NameRef = NewName.toStringRef(NameData);
+ assert(NameRef.find_first_of(0) == StringRef::npos &&
+ "Null bytes are not allowed in names");
// Name isn't changing?
if (getName() == NameRef)
OpenPOWER on IntegriCloud