diff options
author | Caslyn Tonelli <caslyn@google.com> | 2023-04-07 22:16:01 +0000 |
---|---|---|
committer | Caslyn Tonelli <caslyn@google.com> | 2023-04-11 20:49:25 +0000 |
commit | 718729e9971d4ad12d8c7cb088c661202564cf34 (patch) | |
tree | dc38f3b53485679fde47eca928020e017ed48914 /libc/spec | |
parent | 1fa26e64fd87c848ff54d08e9a14ea03e01ae645 (diff) | |
download | llvm-718729e9971d4ad12d8c7cb088c661202564cf34.tar.gz |
[libc] Add memmem implementation
Introduce the `memmem` libc string function.
`memmem_implementation` performs shared logic for `strstr`,
`strcasestr`, and `memmem`; essentially reconfiguring what was the
`strstr_implementation` to support length parameters.
Differential Revision: https://reviews.llvm.org/D147822
Diffstat (limited to 'libc/spec')
-rw-r--r-- | libc/spec/gnu_ext.td | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/spec/gnu_ext.td b/libc/spec/gnu_ext.td index 52fc06157747..bd31897b3f05 100644 --- a/libc/spec/gnu_ext.td +++ b/libc/spec/gnu_ext.td @@ -57,7 +57,12 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> { [], // Macros [], // Types [], // Enumerations - [ + [ + FunctionSpec< + "memmem", + RetValSpec<VoidPtr>, + [ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType] + >, FunctionSpec< "memrchr", RetValSpec<VoidPtr>, |