[libc] Add initial assert definition
authorAlex Brachet <alexbrachetmialot@gmail.com>
Thu, 12 Mar 2020 03:45:58 +0000 (23:45 -0400)
committerAlex Brachet <alexbrachetmialot@gmail.com>
Thu, 12 Mar 2020 03:45:58 +0000 (23:45 -0400)
commitb47c9f535c8a0fffeb7634a82e3901d416915938
tree0ba3321ac6125a98167ddef64733e3e3ce706712
parent6aebf0ee56e52afad3887b4230d7ed1beaf0bede
[libc] Add initial assert definition

Summary: This patch adds a temporary `__assert_fail` and `assert` definition to make it available to internal llvm libc code. `__assert_fail` writes to fd 2 directly instead of `stderr`, using SYS_write. I have not put it in its own linux directory because this is temporary and it should be using stdio's api in the future. It does not currently print out the line number (although we could do that by stringifying `__LINE__` if reviewers wish).

Reviewers: sivachandra, gchatelet, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D75420
12 files changed:
libc/config/linux/api.td
libc/include/CMakeLists.txt
libc/include/assert.h.def [new file with mode: 0644]
libc/lib/CMakeLists.txt
libc/spec/stdc.td
libc/src/CMakeLists.txt
libc/src/assert/CMakeLists.txt [new file with mode: 0644]
libc/src/assert/__assert_fail.cpp [new file with mode: 0644]
libc/src/assert/assert.h [new file with mode: 0644]
libc/test/src/CMakeLists.txt
libc/test/src/assert/CMakeLists.txt [new file with mode: 0644]
libc/test/src/assert/assert_test.cpp [new file with mode: 0644]