Summary:
This is failing on the asan build because we use `-nostdlib`.
I also took this opportunity to make the target name match the naming structure we've been using.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: mgorny, tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D81029
Summary:
This patch aims to add integration tests to check the following:
1) Header files are generated as expected.
2) Libc functions have the correct public name.
3) Libc functions have the correct return type and parameter types.
4) Symbols are exposed in the public lib.a files.
Reviewers: sivachandra, abrachet
Reviewed By: sivachandra
Subscribers: aheejin, ecnelises, dxf, mgorny, jfb, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79192
Summary: This is split off from D79192 and exposes APIGenerator (renames to APIIndexer) for use in generating the integrations tests.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80832
Building libc without clang fails with:
CMake Error at /home/asteinhauser/llvm-project/libc/CMakeLists.txt:49 (message):
'clang' and 'clang-tools-extra' are required in LLVM_ENABLE_PROJECTS to
lint llvm-libc. The linting step performs important checks to help prevent
the introduction of subtle bugs, but it may increase build times.
Reviewers: sivachandra
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D80495
Summary: This is a NFC, it aims at simplifying both the code and build files.
Reviewers: abrachet, sivachandra
Subscribers: mgorny, tschuett, ecnelises, libc-commits, courbet
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80291
Summary: When building llvm-libc with linting enabled, clang-tidy would use the resource dir of the monorepo rather then the host compiler's resource dir. This presented issues when including headers from the host compiler e.g. for sanitizers. Therefore this patch explicitly tells clang-tidy to use the host compiler's resource dir.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: mgorny, tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80265
Summary:
I found that because `--system-headers` flag was not included when running clang-tidy, errors produced from compiler provided headers were being suppressed. After passing this flag I realized that by including headers like stdint.h we were indirectly including headers from the system libc. To prevent this we pass `-ffreestanding`.
We don't want to pass `--system-headers` for all checks just the `llvmlibc-restrict-system-libc-headers` therefore we do a separate invocation of clang-tidy for this check.
Reviewers: abrachet, sivachandra
Reviewed By: sivachandra
Subscribers: mgorny, aheejin, tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80178
A new utils library named 'fputil' is added. This library is used in
math tests and the MPFR wrapper. The math implementations will be
modified to use this library in a later round.
Reviewers: phosek
Differential Revision: https://reviews.llvm.org/D79724
Summary:
These warnings were present when building llvm-libc in release mode.
```
workspace/llvm-project/libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp:50:34: warning: 'None' is deprecated: Use Align() or Align(1) instead [-Wdeprecated-declarations]
Conf.AddressAlignment = Align::None();
workspace/llvm-project/libc/utils/testutils/FDReaderUnix.cpp:19:7: warning: unused variable 'err' [-Wunused-variable]
int err = ::pipe(pipefd);
```
For test-utils it seems in general we should use `report_fatal_error` instead of asserts as these are turned off when building in release mode.
https://llvm.org/docs/CodingStandards.html#assert-liberally
Reviewers: abrachet, sivachandra
Reviewed By: abrachet, sivachandra
Subscribers: tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79469
A few documentation clarifications and moving one part of the
docs around to be closer to the first mention of display so that
it's easier to spot based on some user feedback.
Differential Revision: https://reviews.llvm.org/D79443
Summary:
Math results are compared with MPFR results by checking if they are
within a tolerance level of the MPFR result. The tolerance level is set
using additional bits of precision of the fractional part of a floating
point value. Hence, the actual value of the tolerance depends on not
only the additional bits, but also on the exponent part of the floating
point number.
Previously, the exponent part was not considered in evaluating the
tolerance value. While it was OK for small values less than 1 (hence
sinf, cosf, sincosf tests were OK), it breaks for large values which
functions like exp and friends produce. This change uses the exponent
value also to evaluate the tolerance value. LLVM libc produced results
can now be compared with MPFR produced results for large values also.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D79278
This dramtically reduces the run time of tests. For example,
sincosf_test takes over 25 minutes without this attribute but only 8
seconds with this attribute.
A new test matcher class MPFRMatcher is added along with helper macros
EXPECT|ASSERT_MPFR_MATCH.
New type traits classes RemoveCV and IsFloatingPointType have been
added and used to implement the above class and its helpers.
Reviewers: abrachet, phosek
Differential Revision: https://reviews.llvm.org/D79256
This change does not handle any extensions. Only the C standard
variations are handled.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D79150
Summary: Just to be consistent with other names in cpp.
Reviewers: abrachet
Subscribers: tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79189
This will fix building the wrapper shared library when
BUILD_SHARED_LIBS is ON.
Reviewers: PaulkaToast
Differential Revision: https://reviews.llvm.org/D78737
Deps are recrusively evaluated at the place they are needed. With this
change, one does not have to list recursive deps of entrypoints when
listing test targets. One will still have to explicitly list all
entrypoint objects when setting up an "add_entrypoint_library" target.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D78537
Summary:
The single file was getting too long to be convenient to navigate. This
patch splits it up two into 4 files one each for header rules,
object rules, library rules, and test rules.
Reviewers: abrachet, alexshap
Subscribers: mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D78536
Summary: Adds `write` for Linux and FDReader utility which should be useful for some stdio tests as well.
Reviewers: sivachandra, PaulkaToast
Reviewed By: sivachandra
Subscribers: mgorny, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D78184
Summary: It also re formats long lines in `add_gen_header`
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: mgorny, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D78349
Summary:
This patch implements running linting on llvm-libc using build rule targets.
1) adds a new target per entrypoint for linting with the naming convention `<qualified_target_name>.__lint__` e.g `libc.src.string.strlen.__lint__`.
2) makes the build target for each entrypoint depend on the linting targets so that they run along with compilation of each entrypoint.
3) adds a lint all target named `lint-libc`. `check-libc` now depends on this new target.
4) linting creates a lot of additional targets from clang and clang-tidy that need to be built so an opt out flag can be passed to cmake: `LLVM_LIBC_ENABLE_LINTING`.
Reviewers: sivachandra, abrachet
Reviewed By: sivachandra
Subscribers: abrachet, mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D77861
NFC intended in the implementaton. Only mechanical changes to fit the LLVM
libc implementation standard have been done.
Math testing infrastructure has been added. This infrastructure compares the
results produced by the libc with the high precision results from MPFR.
Tests making use of this infrastructure have been added for cosf, sinf and
sincosf.
Reviewers: abrachet, phosek
Differential Revision: https://reviews.llvm.org/D76825
Summary:
This patch adds a very basic `FILE` type and basic `fwrite`.
It also removes `snprintf` from `StdIO`'s function spec because `VarArgType` was causing the generation to fail.
Reviewers: sivachandra, PaulkaToast
Reviewed By: sivachandra
Subscribers: mgorny, MaskRay, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D77626
Summary: Create self contained functional header which has a type similar to `std::function`
Reviewers: sivachandra, PaulkaToast
Reviewed By: sivachandra
Subscribers: mgorny, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D77948
Only targets setup by the special LLVM libc rules now have fully
qualified names. The naming style is similar to fully qualified names in
Python.
Reviewers: abrachet, PaulkaToast, phosek
Differential Revision: https://reviews.llvm.org/D77340