aboutsummaryrefslogtreecommitdiff
path: root/clang/www
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25[C99] Claim conformance to "new block scopes for selection and iteration ↵Aaron Ballman1-1/+1
statements" I was unable to definitively locate a document number for this, but it is potentially WG14 N759 based on the description in the C99 rationale document. We do implement the C89 and C99 scope rules for iteration and selection statements, so claiming conformance here.
2024-03-25[C99] Claim conformance to "additional predefined macro names"Aaron Ballman1-1/+7
This feature is listed in the C99 front matter as one of the changes to C99, but there was no associated document with that title (or anything close to it). I eventually tracked this down to a new requirement in C99 that implementations defining their own pedefined macros should not name them with a __STDC_ prefix. Clang does not do this, but there's no tests that would demonstrate we properly "implement" this feature. So claiming full conformance without additional test coverage.
2024-03-25[C99] Claim conformance to WG14 N631 and WG14 N696Aaron Ballman1-2/+2
Both of these relate to handling of standard pragmas. N631 is about various STDC pragmas being included in the standard at all, and N696 is about whether macros are expanded in standard pragmas (they're not).
2024-03-25[C99] Claim full support for WG14 N772Aaron Ballman1-1/+1
No tests are added because existing tests cover this. The thrust of the paper is that an implementation needs to support including a header file whose name is eight character or less and contains only letters and numbers; we definitely manage this.
2024-03-25Fixing a think-o with swapped informationAaron Ballman1-1/+1
2024-03-25[clang][analyzer] Bring cplusplus.ArrayDelete out of alpha (#83985)Discookie2-20/+27
The checker finds a type of undefined behavior, where if the type of a pointer to an object-array is different from the objects' underlying type, calling `delete[]` is undefined, as the size of the two objects might be different. The checker has been in alpha for a while now, it is a simple checker that causes no crashes, and considering the severity of the issue, it has a low result-count on open-source projects (in my last test-run on my usual projects, it had 0 results). This commit cleans up the documentation and adds docs for the limitation related to tracking through references, in addition to moving it to `cplusplus`. --------- Co-authored-by: Balazs Benics <benicsbalazs@gmail.com> Co-authored-by: whisperity <whisperity@gmail.com>
2024-03-23[Clang] Update the C++ page with papers approved in TokyoCorentin Jabot1-1/+41
2024-03-22[C11] Update the status of N1365 on constant expression handlingAaron Ballman1-1/+1
This paper is about constant expression handling in the presence of FLT_EVAL_METHOD, which we handle via insertion of implicit cast nodes in the AST.
2024-03-22[C99] Update status of DR290, which we do not yet implementAaron Ballman1-1/+1
2024-03-22[C11] Add test & update status of N1282 and DR087Aaron Ballman2-2/+2
Our existing diagnostics for catching unsequenced modifications handles test coverage for N1282, which is correcting the standard based on the resolution of DR087.
2024-03-20[C11] Add test coverage for N1310 and claim conformanceAaron Ballman1-1/+1
This is about the best I could do for testing that `signed char` does not have any padding bits.
2024-03-18[docs] Prefer --gcc-install-dir= to deprecated GCC_INSTALL_PREFIX (#85458)Fangrui Song1-7/+10
Setting GCC_INSTALL_PREFIX leads to a warning (#77537). Link: https://discourse.llvm.org/t/add-gcc-install-dir-deprecate-gcc-toolchain-and-remove-gcc-install-prefix/65091 Link: https://discourse.llvm.org/t/correct-cmake-parameters-for-building-clang-and-lld-for-riscv/72833
2024-03-13Reapply "[Clang][C++23] Implement P2448R2 ..." (#85136) (#85145)Amy Huang1-8/+1
This reverts commit 003e292f9895a9cf4e30688269efa668d1fcbb09 because there were dependent changes in the codebase that now fail.
2024-03-13Revert "[Clang][C++23] Implement P2448R2 ..." (#85136)Amy Huang1-1/+8
Revert "[Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (#77753)" This reverts commit 99500e8c08a4d941acb8a7eb00523296fb2acf7a because it causes a behavior change for std=c++20. See https://github.com/llvm/llvm-project/pull/77753.
2024-03-09[Clang] Fix status of P1774 Portable assumptionscor3ntin1-1/+1
2024-03-09[Clang][C++23] Implement P1774R8: Portable assumptions (#81014)Sirraide1-1/+1
This implements the C++23 `[[assume]]` attribute. Assumption information is lowered to a call to `@llvm.assume`, unless the expression has side-effects, in which case it is discarded and a warning is issued to tell the user that the assumption doesn’t do anything. A failed assumption at compile time is an error (unless we are in `MSVCCompat` mode, in which case we don’t check assumptions at compile time). Due to performance regressions in LLVM, assumptions can be disabled with the `-fno-assumptions` flag. With it, assumptions will still be parsed and checked, but no calls to `@llvm.assume` will be emitted and assumptions will not be checked at compile time.
2024-03-08[clang] Implement CTAD for type alias template. (#77890)Haojian Wu1-1/+7
Fixes #54051 This patch implements the C++20 feature -- CTAD for alias templates (P1814R0, specified in https://eel.is/c++draft/over.match.class.deduct#3). It is an initial patch: - it cover major pieces, thus it works for most cases; - the big missing piece is to implement the associated constraints (over.match.class.deduct#3.3) for the synthesized deduction guides, see the FIXME in code and tests; - Some enhancements on the TreeTransform&TemplateInstantiator to allow performing instantiation on `BuildingDeductionGuides` mode;
2024-03-08[clang] Respect field alignment in layout compatibility of structs (#84313)Vlad Serebrennikov1-1/+1
This patch implements [CWG2586](https://cplusplus.github.io/CWG/issues/2583.html) "Common initial sequence should consider over-alignment". Note that alignment of union members doesn't have to match, as layout compatibility of unions is not defined in terms of common initial sequence (http://eel.is/c++draft/class.mem.general#25).
2024-03-07[clang] Add CodeGen tests for CWG 5xx issues (#84303)Vlad Serebrennikov1-2/+2
This patch covers [CWG519](https://cplusplus.github.io/CWG/issues/519.html) "Null pointer preservation in `void*` conversions", [CWG571](https://cplusplus.github.io/CWG/issues/571.html) "References declared const".
2024-03-07[Clang] Fix approved revision of P2266cor3ntin1-1/+1
2024-03-07[Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (#77753)Mariya Podchishchaeva1-8/+1
Per https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2448r2.html function/constructor/destructor can be marked `constexpr` even though it never produces a constant expression. Non-literal types as return types and parameter types of functions marked `constexpr` are also allowed. Since this is not a DR, the diagnostic messages are still preserved for C++ standards older than C++23.
2024-03-06[clang][Sema] Bugfix for choosing the more specialized overload (#83279)Botond István Horváth1-1/+1
There was a bug in Clang where it couldn't choose which overload candidate was more specialized if it was comparing a member-function to a non-member function. Previously, this was detected as an ambiguity, now Clang chooses correctly. This patch fixes the bug by fully implementing CWG2445 and moving the template transformation described in `[temp.func.order]` paragraph 3 from `isAtLeastAsSpecializedAs()` to `Sema::getMoreSpecializedTemplate()` so we have the transformed parameter list during the whole comparison. Also, to be able to add the correct type for the implicit object parameter `Sema::getMoreSpecializedTemplate()` has new parameters for the object type. Fixes #74494, fixes #82509
2024-03-06Update C status page now that Clang 18.x is releasedAaron Ballman1-3/+3
2024-03-06[Clang] Mark papers & core issues implemented in clang 18 as releasedCorentin Jabot3-14/+13
2024-03-06[C23] Implement N3018: The constexpr specifier for object definitions (#73099)Mariya Podchishchaeva1-1/+1
The implementation mostly reuses C++ code paths where possible, including narrowing check in order to provide diagnostic messages in case initializer for constexpr variable is not exactly representable in target type. The following won't work due to lack of support for other features: - Diagnosing of underspecified declarations involving constexpr - Constexpr attached to compound literals Also due to lack of support for char8_t some of examples with utf-8 strings don't work properly. Fixes https://github.com/llvm/llvm-project/issues/64742
2024-03-06[clang] Add some CodeGen tests for CWG 4xx issues (#83715)Vlad Serebrennikov1-5/+5
This patch covers the following defect reports: [CWG438](https://cplusplus.github.io/CWG/issues/438.html) "Possible flaw in wording for multiple accesses to object between sequence points", [CWG439](https://cplusplus.github.io/CWG/issues/439.html) "Guarantees on casting pointer back to cv-qualified version of original type", [CWG441](https://cplusplus.github.io/CWG/issues/441.html) "Ordering of static reference initialization", [CWG462](https://cplusplus.github.io/CWG/issues/462.html) "Lifetime of temporaries bound to comma expressions", [CWG492](https://cplusplus.github.io/CWG/issues/492.html) "`typeid` constness inconsistent with example". [CWG475](https://cplusplus.github.io/CWG/issues/475.html) "When is `std::uncaught_exception()` true? (take 2)" requires a libc++abi test. As for [CWG454](https://cplusplus.github.io/CWG/issues/454.html) "When is a definition of a static data member required?", I don't feel confident in my understanding of it, so skipping over it.
2024-02-22[clang] Implement CWG2759 "`[[no_unique_address]` and common initial ↵Vlad Serebrennikov1-1/+1
sequence" (#82607) This patch implements said defect report resolution by adding additional check to common initial sequence evaluation. Consequently, this fixes CWG2759.
2024-02-21[clang] Implement CWG1719 "Layout compatibility and cv-qualification ↵Vlad Serebrennikov1-2/+2
revisited" (#82358) This patch updates our internal notion of `layout-compatible` to ignore cv-qualification, which in turn fixes `__is_layout_compatible` intrinsic.
2024-02-15[clang] Do less advertising for unresolved issues in `cxx_dr_status.html` ↵Vlad Serebrennikov2-42/+83
(#78836) This patch places additional requirement on tests for open issues to specify what do they test, and reduce their advertising on `cxx_dr_status.html`. Tests for open issues have to either provide date of the proposed resolution they test, or a paper number that attempts to resolve the issue. Examples from this patch: `// dr1223: 17 drafting 2023-05-12`, `// dr2049: 18 drafting P2308R1`, `// dr2335: no drafting 2018-06`. Tests for open issues are no longer advertised in `cxx_dr_status.html` as tests for resolved issues. Instead, they are specified as `Not Resolved*` (note the asterisk). Such statuses have a tooltip with the following kind of text: `Clang 17 implements 2023-05-12 resolution` `Clang does not implement 2018-06-04 resolution` `Clang 18 implements P2308R1 resolution` I admit that the wording is a bit crude, but I tried to minimize amount of boilerplate in the `make_cxx_dr_status`. Hopefully, this whole setup matches [C++ compiler support](https://en.cppreference.com/w/cpp/compiler_support) page on cppreference enough for people to catch up. This patch also implement a quality-of-life feature for users of `make_cxx_dr_status`: now script is able to report multiple bad `// dr` comments in a single run. This has also been discussed in a PR for CWG472 test: https://github.com/llvm/llvm-project/pull/67948
2024-02-13[clang] Add some CodeGen tests for CWG 2xx issues (#80823)Vlad Serebrennikov1-3/+3
This patch covers CWG issues [201](https://cplusplus.github.io/CWG/issues/201.html), [210](https://cplusplus.github.io/CWG/issues/210.html), [292](https://cplusplus.github.io/CWG/issues/292.html). [CWG208](https://cplusplus.github.io/CWG/issues/208.html) is not covered, as it actually requires a libcxxabi test. Resolution of CWG292 has been superseded by [P0145R3](https://wg21.link/p0145r3) "Refining Expression Evaluation Order for Idiomatic C++" (see changes to paragraph 5.3.4/18).
2024-02-12[clang] Add some CodeGen tests for CWG 1xx issues (#80338)Vlad Serebrennikov1-4/+4
Covers CWG issues [124](https://cplusplus.github.io/CWG/issues/124.html) [185](https://cplusplus.github.io/CWG/issues/185.html), [193](https://cplusplus.github.io/CWG/issues/193.html), [199](https://cplusplus.github.io/CWG/issues/199.html). I also looked at [190](https://cplusplus.github.io/CWG/issues/190.html), but concluded that we should try to test it via C++20 `std::is_layout_compatible` first. I tried to group tests under `dr1xx-codegen.cpp`, but found out that CodeGen can arbitrarily reorder function definitions in LLVM module. In particular, interleaving between regular function definitions and destructor definitions present in the source might not be preserved, which messes up FileCheck directives. `CHECK-DAG` can help with that, but its interaction with `CHECK-LABEL` (lack of thereof) would require me to relax tests too much.
2024-02-12[clang][analyzer] Remove 'alpha.core.CallAndMessageUnInitRefArg' from ↵Balázs Kéri1-23/+0
documentation (NFC). (#81138) This checker does not exist (any more?) but appeared in the documentation. No other references to CallAndMessageUnInitRefArg are found in the full clang code.
2024-02-09[clang] Add tests for DRs about inheriting constructors (#79981)Vlad Serebrennikov1-8/+8
Covers CWG issues [1150](https://cplusplus.github.io/CWG/issues/1150.html), [1487](https://cplusplus.github.io/CWG/issues/1487.html), [1567](https://cplusplus.github.io/CWG/issues/1567.html), [1738](https://cplusplus.github.io/CWG/issues/1738.html), [2273](https://cplusplus.github.io/CWG/issues/2273.html), [2277](https://cplusplus.github.io/CWG/issues/2277.html), [2356](https://cplusplus.github.io/CWG/issues/2356.html), [2504](https://cplusplus.github.io/CWG/issues/2504.html). On top of the wording in proposed resolutions, [P0136R1](https://wg21.link/p0136r1) "Rewording inheriting constructors (core issue 1941 et al)" is a very relevant paper. Note that status for 1738 `sup P0136R1` is not officially recognized by CWG, but saying `yes` or `no` seems even more confusing to me. Official resolution is to reject certain code, but Clang is the only implementation that still rejects it to this day: https://godbolt.org/z/b1W8jc1o5. GCC rejected it until 9, now it's accepted: https://godbolt.org/z/of6oh4sdT
2024-01-30[Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (#76361)yronglin1-1/+1
Implement P2718R0 "Lifetime extension in range-based for loops" (https://wg21.link/P2718R0) Differential Revision: https://reviews.llvm.org/D153701 --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-01-27[Clang][C++26] Implement Pack Indexing (P2662R3). (#72644)cor3ntin1-1/+1
Implements https://isocpp.org/files/papers/P2662R3.pdf The feature is exposed as an extension in older language modes. Mangling is not yet supported and that is something we will have to do before release.
2024-01-25[clang] Add test for CWG472 (#67948)Vlad Serebrennikov1-1/+1
https://cplusplus.github.io/CWG/issues/472.html It has drafting status, but I think CWG has reached consesus on the behavior. Related: #16602
2024-01-24Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the ↵Alexander Kornienko1-2/+2
same type) (#77768)" This reverts commit 924701311aa79180e86ad8ce43d253f27d25ec7d. Causes compilation errors on valid code, see https://github.com/llvm/llvm-project/pull/77768#issuecomment-1908062472.
2024-01-21[c++20] P1907R1: Support for generalized non-type template arguments of ↵Andrey Ali Khan Bolshakov1-5/+13
scalar type. (#78041) Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and reverted because a dependency commit was reverted, then committed again as 4b574008aef5a7235c1f894ab065fe300d26e786 and reverted again because "dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e was reverted. But it doesn't seem that 5a391d38ac6c was a real dependency for this. This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 and 18e093faf726d15f210ab4917142beec51848258 by Richard Smith (@zygoloid), with some minor fixes, most notably: - `UncommonValue` renamed to `StructuralValue` - `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and member pointer handling branch in `BuildExpressionFromNonTypeTemplateArgumentValue`; - handling of `StructuralValue` in `IsTypeDeclaredInsideVisitor`; - filling in `SugaredConverted` along with `CanonicalConverted` parameter in `Sema::CheckTemplateArgument`; - minor cleanup in `TemplateInstantiator::transformNonTypeTemplateParmRef`; - `TemplateArgument` constructors refactored; - `ODRHash` calculation for `UncommonValue`; - USR generation for `UncommonValue`; - more correct MS compatibility mangling algorithm (tested on MSVC ver. 19.35; toolset ver. 143); - IR emitting fixed on using a subobject as a template argument when the corresponding template parameter is used in an lvalue context; - `noundef` attribute and opaque pointers in `template-arguments` test; - analysis for C++17 mode is turned off for templates in `warn-bool-conversion` test; in C++17 and C++20 mode, array reference used as a template argument of pointer type produces template argument of UncommonValue type, and `BuildExpressionFromNonTypeTemplateArgumentValue` makes `OpaqueValueExpr` for it, and `DiagnoseAlwaysNonNullPointer` cannot see through it; despite of "These cases should not warn" comment, I'm not sure about correct behavior; I'd expect a suggestion to replace `if` by `if constexpr`; - `temp.arg.nontype/p1.cpp` and `dr18xx.cpp` tests fixed.
2024-01-21[C23] Implement N2490, Remove trigraphs??!Aaron Ballman1-1/+1
This follows the same implementation logic as with C++ and is compatible with the GCC behavior in C. Trigraphs are enabled by default in -std=c* conformance modes before C23, but are disabled in GNU and Microsoft modes as well as in C23 or later.
2024-01-20[clang] Implement CWG1878 "`operator auto` template" (#78103)Vlad Serebrennikov1-1/+1
C++14 introduced deduced return type for regular functions, but shortly after [CWG1878](https://wg21.link/cwg1878) was filed and resolved to disallow deduced return types in conversion function templates. So this patch diagnoses such usage of deduced return type in C++14 mode onwards. Fixes #51776
2024-01-19[SemaCXX] Implement CWG2137 (list-initialization from objects of the same ↵Mital Ashok1-2/+2
type) (#77768) Closes #77638, #24186 Rebased from <https://reviews.llvm.org/D156032>, see there for more information. Implements wording change in [CWG2137](https://wg21.link/CWG2137) in the first commit. This also implements an approach to [CWG2311](https://wg21.link/CWG2311) in the second commit, because too much code that relies on `T{ T_prvalue}` being an elision would break. Because that issue is still open and the CWG issue doesn't provide wording to fix the issue, there may be different behaviours on other compilers.
2024-01-18[clang] Add test for CWG1807 (#77637)Vlad Serebrennikov1-1/+1
The test checks that objects in arrays are destructed in reverse order during stack unwinding. This patch is trying to establish a precedent how codegen tests for C++ defect report test suite should be written. Refer to PR for exact reasoning.
2024-01-17[Clang] Implement CWG2598: Union of non-literal types (#78195)cor3ntin1-2/+2
A union is considered a literal type unless it has no non-literal member. This resolves CWG2096 (which makes unions with literal members literal) and CWG2598 (empty unions are literal types). Fixes #77924
2024-01-14[clang] Add tests for DRs about complete-class context (#77444)Vlad Serebrennikov1-4/+4
[P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. [Drafting note: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — end drafting note] ([class.member.lookup]/4) Complete-class context is described in [class.mem.general] [p7](http://eel.is/c++draft/class#mem.general-7) and [p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests only for CWG issues that fall under current definition of complete-class context, because I'm not sure how CWG1255 and CWG287 are going to work. That's why I skip over them, but mark CWG1308 as superseded by CWG1330.
2024-01-14[clang] Add test for CWG1350 (#78040)Vlad Serebrennikov1-1/+1
Test is based on [P0136R1](https://wg21.link/p0136r1) wording instead of proposed resolution in the issue itself. This patch also expands related CWG1573 test with an additional test case. Existing `3.9` status of 1573 is still relevant even with this new test case.
2024-01-11[clang] Fix color consistency in C paper tracking web pageCorentin Jabot1-1/+1
2024-01-11[clang] Improve colors in status tracking web pages.Corentin Jabot4-1623/+1625
Use a consistent, more pastel color for unknown status in papers and issues tracking pages
2024-01-10[clang] Add tests for CWG1800-1804 (#77509)Vlad Serebrennikov1-6/+6
Covers C++ core issues 1800, 1801, 1802, 1803, 1804.
2024-01-09[clang] Update cxx_dr_status.html (#77372)Vlad Serebrennikov1-179/+545
This patch updates `cxx_dr_status.html` to bring it in sync with Core Issues List Revision 113.
2023-12-13[attributes][analyzer] Implement [[clang::suppress]] - suppress static ↵Artem Dergachev1-6/+39
analysis warnings. The new attribute can be placed on statements in order to suppress arbitrary warnings produced by static analysis tools at those statements. Previously such suppressions were implemented as either informal comments (eg. clang-tidy `// NOLINT:`) or with preprocessor macros (eg. clang static analyzer's `#ifdef __clang_analyzer__`). The attribute provides a universal, formal, flexible and neat-looking suppression mechanism. Implement support for the new attribute in the clang static analyzer; clang-tidy coming soon. The attribute allows specifying which specific warnings to suppress, in the form of free-form strings that are intended to be specific to the tools, but currently none are actually supported; so this is also going to be a future improvement. Differential Revision: https://reviews.llvm.org/D93110