diff options
author | Timm Baeder <tbaeder@redhat.com> | 2024-12-09 16:17:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-09 16:17:39 +0100 |
commit | d17e51f306cb3522af7587bf1f3a2f4956ab3a19 (patch) | |
tree | fed5d3614a873ef6804e1550ff1a36de33bd065d /clang/test/AST/ByteCode/builtin-functions.cpp | |
parent | d1cf86fe53bd89e107f8348a117754b59b4ffca5 (diff) | |
download | llvm-d17e51f306cb3522af7587bf1f3a2f4956ab3a19.zip llvm-d17e51f306cb3522af7587bf1f3a2f4956ab3a19.tar.gz llvm-d17e51f306cb3522af7587bf1f3a2f4956ab3a19.tar.bz2 |
[clang][bytecode] Handle __builtin_strncmp (#119208)
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r-- | clang/test/AST/ByteCode/builtin-functions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 4c21496..bd453d6 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -51,6 +51,15 @@ namespace strcmp { return __builtin_strcmp(buffer, "mutable") == 0; } static_assert(char_memchr_mutable(), ""); + + static_assert(__builtin_strncmp("abaa", "abba", 5) == -1); + static_assert(__builtin_strncmp("abaa", "abba", 4) == -1); + static_assert(__builtin_strncmp("abaa", "abba", 3) == -1); + static_assert(__builtin_strncmp("abaa", "abba", 2) == 0); + static_assert(__builtin_strncmp("abaa", "abba", 1) == 0); + static_assert(__builtin_strncmp("abaa", "abba", 0) == 0); + static_assert(__builtin_strncmp(0, 0, 0) == 0); + static_assert(__builtin_strncmp("abab\0banana", "abab\0canada", 100) == 0); } /// Copied from constant-expression-cxx11.cpp |