[PATCH] D53342: [SimplifyLibCalls] Mark known arguments with nonnull
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 18 07:15:10 PDT 2019
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:255
+ setNonNullParam(CI, 0);
// We don't do anything if length is not constant.
----------------
jdoerfert wrote:
> Why is non-null supposed to be "allowed" for the destination but not the source in case the length is 0?
s = NULL;
strncat(d, s, 0) -> valid
The strncat() function is similar, except that
* it will use at most n bytes from src; and
* src does not need to be null-terminated if it contains n or more
bytes.
As with strcat(), the resulting string in dest is always null-termi‐
nated.
so "d" (dest) is always null terminated (and must be nonnull).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D53342/new/
https://reviews.llvm.org/D53342
More information about the llvm-commits
mailing list