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!

llvm-svn: 131747
1 file changed
tree: 546c4117f825dc9116b4d974671eee6d86740dd2
  1. clang/
  2. compiler-rt/
  3. debuginfo-tests/
  4. libcxx/
  5. libcxxabi/
  6. lldb/
  7. llvm/
  8. polly/