aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Headers
AgeCommit message (Collapse)AuthorFilesLines
2022-09-15Downgrade implicit int and implicit function declaration to warning onlyAaron Ballman1-5/+5
The changes in Clang 15.0.0 which enabled these diagnostics as a warning which defaulted to an error caused disruption for people working on distributions such as Gentoo. There was an explicit request to downgrade these to be warning-only in Clang 15.0.1 with the expectation that Clang 16 will default the diagnostics to an error. See https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 for more details on the discussion. See https://reviews.llvm.org/D133800 for the public review of these changes.
2022-07-20Inliner: don't mark call sites as 'nounwind' if that would be redundantNicolai Hähnle1-72/+72
When F calls G calls H, G is nounwind, and G is inlined into F, then the inlined call-site to H should be effectively nounwind so as not to lose information during inlining. If H itself is nounwind (which often happens when H is an intrinsic), we no longer mark the callsite explicitly as nounwind. Previously, there were cases where the inlined call-site of H differs from a pre-existing call-site of H in F *only* in the explicitly added nounwind attribute, thus preventing common subexpression elimination. v2: - just check CI->doesNotThrow v3 (resubmit after revert at 344378808778c61d5599f4e0ac783ef7e6f8ed05): - update Clang tests Differential Revision: https://reviews.llvm.org/D129860
2022-07-12Undeprecate ATOMIC_FLAG_INIT in C++Aaron Ballman1-2/+1
C++20 deprecated ATOMIC_FLAG_INIT thinking it was deprecated in C when it wasn't. It is expected to be undeprecated in C++23 as part of LWG3659 (https://wg21.link/LWG3659), which is currently Tentatively Ready. This handles the case where the user includes <stdatomic.h> in C++ code in a freestanding compile mode. The corollary libc++ changes are in 1544d1f9fdb115782202d72ad200c3f93b2c4f5a.
2022-06-15[OpenCL] Reword unknown extension pragma diagnosticSven van Haastregt1-1/+1
For newer OpenCL extensions that do not require a pragma, such as `cl_khr_subgroup_shuffle`, a user could still accidentally attempt to use a pragma. This would result in a warning "unknown OpenCL extension 'cl_khr_subgroup_shuffle' - ignoring" which could be mistakenly interpreted as "clang does not support this extension at all" instead of "clang does not require any pragma for this extension". Differential Revision: https://reviews.llvm.org/D126660
2022-05-26Roll back use of #warning for header deprecationsAaron Ballman1-8/+1
e5ccd668019888de2704ae670da88a7be8cf7e0f and 5029dce492b3cf3ac191eda0b5bf268c3acac2e0 added deprecation warnings to the <stdbool.h> and <stdnoreturn.h> headers, respectively, because the headers are deprecated in C2x. However, there are system headers that include these headers unconditionally, and #warning diagnostics within system headers are shown to users instead of suppressed, which means these deprecation warnings are being triggered in circumstances that users have no control over except to disable all the warnings through the _CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro or other means. This removes the problematic #warning uses until we find a more palatable solution.
2022-05-18[OpenCL] Add cl_khr_subgroup_rotate builtinsSven van Haastregt1-0/+6
Differential Revision: https://reviews.llvm.org/D124256
2022-05-13Comment parsing: Allow inline commands to have 0 or more than 1 argumentAaron Puchert1-2/+2
That's required to support `\n`, but can also be used for other commands. We already had the infrastructure in place to parse a varying number of arguments, we simply needed to generalize it so that it would work not only for block commands. This should fix #55319. Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D125429
2022-05-12[Headers][MSVC] Define wchar_t in stddef.h like MSVC if not using the ↵Stephen Long1-0/+6
builtin type MSVC expects wchar_t to be defined in stddef.h if /Zc:wchar_t- is specified Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D124026
2022-05-08[Headers][X86] Enable basic Wdocumentation testing on X86 headersSimon Pilgrim1-4/+4
First part of Issue #35297 - we want to enable Wdocumentation-pedantic as well, but need '\n' support first which Issue #55319 is addressing
2022-05-08[X86] Fix some signedness errors in x86 headersSimon Pilgrim1-2/+2
Another step toward enabling full -Wsystem-headers testing across all x86 headers Fix a number of cases where the arg / return value signedness doesn't match the C/C++ intrinsic. So far I've just added explicit casts as necessary, but we might want to address some of the mismatches directly Differential Revision: https://reviews.llvm.org/D125164
2022-05-07[X86] Add 32-bit target test coverage to clean header testsSimon Pilgrim1-2/+7
2022-04-20[C11/C2x] Change the behavior of the implicit function declaration warningAaron Ballman2-7/+7
C89 had a questionable feature where the compiler would implicitly declare a function that the user called but was never previously declared. The resulting function would be globally declared as extern int func(); -- a function without a prototype which accepts zero or more arguments. C99 removed support for this questionable feature due to severe security concerns. However, there was no deprecation period; C89 had the feature, C99 didn't. So Clang (and GCC) both supported the functionality as an extension in C99 and later modes. C2x no longer supports that function signature as it now requires all functions to have a prototype, and given the known security issues with the feature, continuing to support it as an extension is not tenable. This patch changes the diagnostic behavior for the -Wimplicit-function-declaration warning group depending on the language mode in effect. We continue to warn by default in C89 mode (due to the feature being dangerous to use). However, because this feature will not be supported in C2x mode, we've diagnosed it as being invalid for so long, the security concerns with the feature, and the trivial workaround for users (declare the function), we now default the extension warning to an error in C99-C17 mode. This still gives users an easy workaround if they are extensively using the extension in those modes (they can disable the warning or use -Wno-error to downgrade the error), but the new diagnostic makes it more clear that this feature is not supported and should be avoided. In C2x mode, we no longer allow an implicit function to be defined and treat the situation the same as any other lookup failure. Differential Revision: https://reviews.llvm.org/D122983
2022-04-07[Clang] Add -no-opaque-pointers to more tests (NFC)Nikita Popov1-1/+1
This adds the flag to more tests that were not caught by the mass-migration in 532dc62b907554b3f07f17205674aa71e76fc863.
2022-04-07[OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)Nikita Popov2-19/+19
This adds -no-opaque-pointers to clang tests whose output will change when opaque pointers are enabled by default. This is intended to be part of the migration approach described in https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9. The patch has been produced by replacing %clang_cc1 with %clang_cc1 -no-opaque-pointers for tests that fail with opaque pointers enabled. Worth noting that this doesn't cover all tests, there's a remaining ~40 tests not using %clang_cc1 that will need a followup change. Differential Revision: https://reviews.llvm.org/D123115
2022-03-16[CodeGen] Inline _byteswap_* builtins.Eli Friedman1-4/+4
As discussed in D57915. Fixes https://github.com/llvm/llvm-project/issues/39999 . Differential Revision: https://reviews.llvm.org/D121865
2022-03-09[clang][sema] Enable first-class bool support for C2xTimm Bäder1-0/+19
Implement N2395 for C2x. This also covers adding "bool", which is part of N2394. Differential Revision: https://reviews.llvm.org/D120244
2022-02-24[InstCombine] Canonicalize SPF to min/max intrinsicsNikita Popov1-44/+32
Now that integer min/max intrinsics have good support in both InstCombine and other passes, start canonicalizing SPF min/max to intrinsic min/max. Once this sticks, we can stop matching SPF min/max in various places, and can remove hacks we have for preventing infinite loops and breaking of SPF canonicalization. Differential Revision: https://reviews.llvm.org/D98152
2022-02-17AST: Move __va_list tag back to std conditionally on AArch64.Peter Collingbourne1-1/+1
In post-commit feedback on D104830 Jessica Clarke pointed out that unconditionally adding __va_list to the std namespace caused namespace debug info to be emitted in C, which is not only inappropriate but turned out to confuse the dtrace tool. Therefore, move __va_list back to std only in C++ so that the correct debug info is generated. We also considered moving __va_list to the top level unconditionally but this would contradict the specification and be visible to AST matchers and such, so make it conditional on the language mode. To avoid breaking name mangling for __va_list, teach the Itanium name mangler to always mangle it as if it were in the std namespace when targeting ARM architectures. This logic is not needed for the Microsoft name mangler because Microsoft platforms define va_list as a typedef of char *. Depends on D116773 Differential Revision: https://reviews.llvm.org/D116774
2022-02-17[Clang] Add attributes alloc_size and alloc_align to mm_mallocDávid Bolvanský2-0/+19
LLVM optimizes source codes with mm_malloc better, especially due to alignment info. alloc align https://clang.llvm.org/docs/AttributeReference.html#alloc-align alloc size https://clang.llvm.org/docs/AttributeReference.html#alloc-size Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D117091
2022-02-09Use functions with prototypes when appropriate; NFCAaron Ballman5-10/+10
A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the sixth batch of tests being updated (there are a significant number of other tests left to be updated).
2022-01-29Revert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes appliedAaron Ballman1-1/+4
fad7e491a0770ac4336934030ac67d77e7af5520 was a revert of 86797fdb6f51d32f285e48b6d3e0fc5b8b852734 due to build failures. This hopefully fixes them.
2022-01-28Revert "Add BITINT_MAXWIDTH support"Jan Korous1-4/+1
This reverts commit 86797fdb6f51d32f285e48b6d3e0fc5b8b852734. Differential Revision: https://reviews.llvm.org/D117238
2022-01-28Add BITINT_MAXWIDTH supportAaron Ballman1-1/+4
Part of the _BitInt feature in C2x (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2763.pdf) is a new macro in limits.h named BITINT_MAXWIDTH that can be used to determine the maximum width of a bit-precise integer type. This macro must expand to a value that is at least as large as ULLONG_WIDTH. This adds an implementation-defined macro named __BITINT_MAXWIDTH__ to specify that value, which is used by limits.h for the standard macro. This also limits the maximum bit width to 128 bits because backends do not currently support all mathematical operations (such as division) on wider types yet. This maximum is expected to be increased in the future.
2022-01-28[AIX][clang] include_next through clang provided float.hDavid Tenty2-0/+8
AIX provides additional definitions in the system libc float.h that we would like to be available to users, so we need to include_next through, similar to what is done on some other platforms. We also adjust the guards for some definitions which are restricted based on language level to also be provide with the _ALL_SOURCE feature test macro on AIX, similar to what is done by the platform float.h header, so we don't run into cases where we don't provide the compiler macro but still have a different definition from the system. Differential Revision: https://reviews.llvm.org/D117935
2022-01-22[RISCV] Remove experimental prefix from rvv-related extensions.eopXD1-1/+1
Extensions affected: +v, +zve*, +zvl* Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D117860
2022-01-18Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecatedAaron Ballman1-0/+18
C17 deprecated ATOMIC_VAR_INIT with the resolution of DR 485. C++ followed suit when adopting P0883R2 for C++20, but additionally chose to deprecate ATOMIC_FLAG_INIT at the same time despite the macro still being required in C. This patch marks both macros as deprecated when appropriate to do so.
2022-01-16[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵hyeongyu kim2-17/+17
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169
2022-01-13Support the *_WIDTH macros in limits.h and stdint.hAaron Ballman2-3/+295
This completes the implementation of WG14 N2412 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2412.pdf), which standardizes C on a twos complement representation for integer types. The only work that remained there was to define the correct macros in the standard headers, which this patch does.
2022-01-11[HIP] Fix device malloc/freeYaxun (Sam) Liu1-4/+15
ROCm 4.5 device library introduced __ockl_dm_alloc and __ockl_dm_dealloc for supporting device side malloc/free. This patch redefines device malloc/free to use these functions. It also fixes a bug in the wrapper header which incorrectly defines free with return type void* instead of void. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D116967
2021-12-13[instcombine] Canonicalize constant index type to i64 for ↵Philip Reames1-182/+182
extractelement/insertelement The basic idea to this is that a) having a single canonical type makes CSE easier, and b) many of our transforms are inconsistent about which types we end up with based on visit order. I'm restricting this to constants as for non-constants, we'd have to decide whether the simplicity was worth extra instructions. For constants, there are no extra instructions. We chose the canonical type as i64 arbitrarily. We might consider changing this to something else in the future if we have cause. Differential Revision: https://reviews.llvm.org/D115387
2021-11-13[ARM/AArch64] Move REQUIRES after update_cc_test_checks line. NFCDavid Green3-6/+7
c17d9b4b125e5561925aa added REQUIRES lines to a lot of Arm and AArch64 test, but added them to the very beginning, before the existing update_cc_test_checks lines. This just moves them later so as to not mess up the existing ordering when the checks are regenerated.
2021-11-09headers: optionalise some generated resource headersSaleem Abdulrasool4-0/+8
This splits out the generated headers and conditonalises them upon the target being enabled. The motivation here is that the RISCV header alone added 10MB to the resource directory, which was previously at 10MB, increasing the build size and time. This header is contributing ~50% of the size of the resource headers (~10MB). The ARM generated headers are contributing about ~10% or 1MB. This could be extended further adding only the static resource headers for the targets that the LLVM build supports. The changes to the tests for ARM mirror what the RISCV target already did and rnk identified as a possible issue. Testing: cmake -G Ninja -D LLVM_TARGETS_TO_BUILD=X86 -D LLVM_ENABLE_PROJECTS="clang;lld" ../clang ninja check-clang Differential Revision: https://reviews.llvm.org/D112890 Reviewed By: craig.topper
2021-11-09Revert "[Clang/Test]: Rename enable_noundef_analysis to ↵hyeongyu kim2-17/+17
disable-noundef-analysis and turn it off by default" This reverts commit aacfbb953eb705af2ecfeb95a6262818fa85dd92. Revert "Fix lit test failures in CodeGenCoroutines" This reverts commit 63fff0f5bffe20fa2c84a45a41161afa0043cb34.
2021-11-08[SPIR-V] Add SPIR-V triple and clang target info.Anastasia Stulova1-1/+4
Add new triple and target info for ‘spirv32’ and ‘spirv64’ and, thus, enabling clang (LLVM IR) code emission to SPIR-V target. The target for SPIR-V is mostly reused from SPIR by derivation from a common base class since IR output for SPIR-V is mostly the same as SPIR. Some refactoring are made accordingly. Added and updated tests for parts that are different between SPIR and SPIR-V. Patch by linjamaki (Henry Linjamäki)! Differential Revision: https://reviews.llvm.org/D109144
2021-11-06[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵hyeongyukim2-17/+17
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169 [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default (2) This patch updates test files after D105169. Autogenerated test codes are changed by `utils/update_cc_test_checks.py,` and non-autogenerated test codes are changed as follows: (1) I wrote a python script that (partially) updates the tests using regex: {F18594904} The script is not perfect, but I believe it gives hints about which patterns are updated to have `noundef` attached. (2) The remaining tests are updated manually. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D108453 Resolve lit failures in clang after 8ca4b3e's land Fix lit test failures in clang-ppc* and clang-x64-windows-msvc Fix missing failures in clang-ppc64be* and retry fixing clang-x64-windows-msvc Fix internal_clone(aarch64) inline assembly
2021-11-06Revert "[Clang/Test]: Rename enable_noundef_analysis to ↵Juneyoung Lee2-17/+17
disable-noundef-analysis and turn it off by default" This reverts commit 7584ef766a7219b6ee5a400637206d26e0fa98ac.
2021-11-06[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵Juneyoung Lee2-17/+17
turn it off by default Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169
2021-10-18Revert D105169 due to the two-stage failure in ASANJuneyoung Lee2-17/+17
This reverts the following commits: 37ca7a795b277c20c02a218bf44052278c03344b 9aa6c72b92b6c89cc6d23b693257df9af7de2d15 705387c5074bcca36d626882462ebbc2bcc3bed4 8ca4b3ef19fe82d7ad6a6e1515317dcc01b41515 80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a
2021-10-16[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and ↵Juneyoung Lee2-17/+17
turn it off by default (2) This patch updates test files after D105169. Autogenerated test codes are changed by `utils/update_cc_test_checks.py,` and non-autogenerated test codes are changed as follows: (1) I wrote a python script that (partially) updates the tests using regex: {F18594904} The script is not perfect, but I believe it gives hints about which patterns are updated to have `noundef` attached. (2) The remaining tests are updated manually. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D108453
2021-10-06[CUDA] remove unneeded includes from CUDA-related headers.Artem Belevich1-2/+0
This should fix bot failures on PPC and windows.
2021-10-06[CUDA] Implement experimental support for texture lookups.Artem Belevich3-2/+37
The patch implements header-only support for testure lookups. The patch has been tested on a source file with all possible combinations of argument types supported by CUDA headers, compiled and verified that the generated instructions and their parameters match the code generated by NVCC. Unfortunately, compiling texture code requires CUDA headers and can't be tested in clang itself. The test will need to be added to the test-suite later. While generated code compiles and seems to match NVCC, I do not have any code that uses textures that I could test correctness of the implementation. Hence the experimental status. Differential Revision: https://reviews.llvm.org/D110089
2021-09-22[InstCombine] Update InstCombine to use poison instead of undef for ↵hyeongyu kim1-7/+7
shufflevector's placeholder (1/3) This patch is for fixing potential shufflevector-related bugs like D93818. As D93818, this patch change shufflevector's default placeholder to poison. To reduce risk, it was divided into several patches, and this patch is for InstCombineCasts. Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D110226
2021-09-21[OpenCL] Test case for C++ for OpenCL 2021 in OpenCL C header testJustas Janickas1-3/+4
RUN line representing C++ for OpenCL 2021 added to the test. This should have been done as part of earlier commit fb321c2ea274 but was missed during rebasing. Differential Revision: https://reviews.llvm.org/D109492
2021-09-14Check supported architectures in sseXYZ/avxXYZ headersserge-sans-paille1-0/+5
It doesn't make sense to include those headers on the wrong architecture, provide an explicit error message in that case. Fix https://bugs.llvm.org/show_bug.cgi?id=48915 Differential Revision: https://reviews.llvm.org/D109686
2021-09-13[OpenCL] Support cl_ext_float_atomicsSven van Haastregt1-0/+90
See https://github.com/KhronosGroup/OpenCL-Docs/pull/552 for initial specification. Patch by Haonan Yang. Differential Revision: https://reviews.llvm.org/D106343
2021-09-09[AMDGPU][OpenMP] Use complex definitions from complex_cmath.hPushpinder Singh1-0/+85
Following nvptx approach, this patch uses complex function definitions from complex_cmath.h. With this patch, ovo passes 23/34 complex mathematical test cases. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D109344
2021-09-01[OpenCL] Define OpenCL 3.0 optional core features in C++ for OpenCL 2021Justas Janickas1-3/+3
Modifies OpenCL 3.0 optional core feature macro definitions so that they are set analogously in C++ for OpenCL 2021. This change aims to achieve compatibility between C++ for OpenCL 2021 and OpenCL 3.0. Differential Revision: https://reviews.llvm.org/D108704
2021-08-25Effectively revert 33c3d8a916c / D33782Reid Kleckner3-54/+0
This change would treat the token `or` in system headers as an identifier, and elsewhere as an operator. As reported in llvm.org/pr42427, many users classify their third party library headers as "system" headers to suppress warnings. There's no clean way to separate Windows SDK headers from user headers. Clang is still able to parse old Windows SDK headers if C++ operator names are disabled. Traditionally this was controlled by `-fno-operator-names`, but is now also enabled with `/permissive` since D103773. This change will prevent `clang-cl` from parsing <query.h> from the Windows SDK out of the box, but there are multiple ways to work around that: - Pass `/clang:-fno-operator-names` - Pass `/permissive` - Pass `-DQUERY_H_RESTRICTION_PERMISSIVE` In all of these modes, the operator names will consistently be available or not available, instead of depending on whether the code is in a system header. I added a release note for this, since it may break straightforward users of the Windows SDK. Fixes PR42427 Differential Revision: https://reviews.llvm.org/D108720
2021-08-24[OpenMP][AMDGCN] Enable complex functionsPushpinder Singh1-0/+50
This patch enables basic complex functionality using the ocml builtins. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D108552
2021-08-20[WebAssembly] Restore builtins and intrinsics for pmin/pmaxThomas Lively1-14/+12
Partially reverts 85157c007903, which had removed these builtins and intrinsics in favor of normal codegen patterns. It turns out that it is possible for the patterns to be split over multiple basic blocks, however, which means that DAG ISel is not able to select them to the pmin/pmax instructions. To make sure the SIMD intrinsics generate the correct instructions in these cases, reintroduce the clang builtins and corresponding LLVM intrinsics, but also keep the normal pattern matching as well. Differential Revision: https://reviews.llvm.org/D108387