[PATCH] D88824: [Support][unittests] Enforce alignment in ConvertUTFTest

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 06:14:14 PDT 2020


grimar accepted this revision.
grimar added a comment.
This revision is now accepted and ready to land.

LGTM with nit addressed. But please wait for a second opinion.



================
Comment at: llvm/lib/Support/ConvertUTFWrapper.cpp:100
 
+  assert((uintptr_t)Src % sizeof(UTF16) == 0);
+
----------------
I think more natural way is to test pre-conditions for arguments before using them?
I.e. I'd move this line before `const UTF16 *Src =...`

```
assert((uintptr_t)SrcBytes.begin() % sizeof(UTF16) == 0);
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88824/new/

https://reviews.llvm.org/D88824



More information about the llvm-commits mailing list