Add asserts in StringRef to make sure we avoid undefined behavior:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 20 May 2011 19:24:12 +0000 (19:24 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 20 May 2011 19:24:12 +0000 (19:24 +0000)
commit6d5502eb4966fb2f81fe951d0acf11cfa5cd4acf
tree5982645c94efdfc95064ae37c960327071fc24db
parent0e29ed081b24359978916b997e91e3e1e2293915
Add asserts in StringRef to make sure we avoid undefined behavior:

-strlen should not be called with NULL. Also guarantee that StringRef's Length is 0 if Data is NULL.
-memcmp should not be called with NULL (even if size is 0)

Patch by Matthieu Monrocq!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131747 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/StringRef.h