aboutsummaryrefslogtreecommitdiff
path: root/clang/www
AgeCommit message (Collapse)AuthorFilesLines
2024-06-17[Clang] Introduce `CXXTypeidExpr::hasNullCheck` (#95718)Mital Ashok1-1/+1
Used to implement CWG2191 where `typeid` for a polymorphic glvalue only becomes potentially-throwing if the `typeid` operand was already potentially throwing or a `nullptr` check was inserted: https://cplusplus.github.io/CWG/issues/2191.html Also change `Expr::hasSideEffects` for `CXXTypeidExpr` to check the operand for side-effects instead of always reporting that there are side-effects Remove `IsDeref` parameter of `CGCXXABI::shouldTypeidBeNullChecked` because it should never return `true` if `!IsDeref` (we shouldn't add a null check that wasn't there in the first place)
2024-06-17[clang][NFC] Update C++ DR issues listVlad Serebrennikov1-9/+33
2024-06-13[clang][NFC] Update CWG issues listVlad Serebrennikov1-0/+6
2024-06-13Revert "[clang][NFC] Add a test for CWG2685" (#95389)Younan Zhang1-1/+1
I was wrong: The purpose of CWG2685 is to avoid brace elision on string literals and we should be rejecting the case. Reverts llvm/llvm-project#95206
2024-06-13[clang][NFC] Add a test for CWG2685 (#95206)Younan Zhang1-1/+1
I believe it has been implemented since D139837 "Implements CTAD for aggregates P1816R0 and P2082R1", so this just claims we have already supported it. Plus an update on the dr status page.
2024-06-12Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C ↵Vitaly Buka1-1/+1
and Obj-C++ by-proxy)" (#95299) Reverts llvm/llvm-project#68620 Introduce or expose a memory leak and UB, see llvm/llvm-project#68620
2024-06-12[analyzer] Finish moving alpha.core.SizeofPtr to clang-tidy (#95118)Donát Nagy1-16/+0
The checker `alpha.core.SizeofPtr` was a very simple checker that did not rely on path sensitive analysis and was very similar to the (more complex and refined) clang-tidy check `bugprone-sizeof-expression`. As there is no reason to maintain two separate implementations for the same goal (and clang-tidy is more lightweight and accessible than the Analyzer) I decided to move this functionality from the Static Analyzer to clang-tidy. Recently my commit 546c816a529835a4cf89deecff957ea336a94fa2 reimplemented the advantageous parts of `alpha.core.SizeofPtr` within clang-tidy; now this commit finishes the transfer by deleting `alpha.core.SizeofPtr`.
2024-06-12[clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and ↵The Phantom Derpstorm1-1/+1
Obj-C++ by-proxy) (#68620) This commit implements the entirety of the now-accepted [N3017 - Preprocessor Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and its sister C++ paper [p1967](https://wg21.link/p1967). It implements everything in the specification, and includes an implementation that drastically improves the time it takes to embed data in specific scenarios (the initialization of character type arrays). The mechanisms used to do this are used under the "as-if" rule, and in general when the system cannot detect it is initializing an array object in a variable declaration, will generate EmbedExpr AST node which will be expanded by AST consumers (CodeGen or constant expression evaluators) or expand embed directive as a comma expression. --------- Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: H. Vetinari <h.vetinari@gmx.com> Co-authored-by: Podchishchaeva, Mariya <mariya.podchishchaeva@intel.com>
2024-06-09[clang][NFC] Update CWG issues listVlad Serebrennikov1-0/+12
2024-06-06Revert "Reapply "[Clang][CWG1815] Support lifetime extension of temporary ↵bgra81-1/+1
created by aggregate initialization using a default member initializer" (#92527)" (#94600) Reverting due to https://github.com/llvm/llvm-project/pull/92527#issuecomment-2149120420. This reverts commit f049d72ac2bcc40fd91d4e95148658021fb24bf1. Co-authored-by: Bogdan Graur <bgraur@google.com>
2024-06-05[Clang] Static and explicit object member functions with the same ↵cor3ntin2-4/+4
parameter-type-lists (#93430) Implement P2797. Because taking the address of an explicit object member function results in a function pointer, a call expression where the id-expression is an explicit object member is made to behave consistently with that model. This change forces clang to perform overload resolution in the presence of an id-expression of the form `(&Foo::bar)(args...)`, which we previously failed to do consistently.
2024-06-04[clang] Add tests for Core issues about friend templates (#94288)Vlad Serebrennikov1-3/+3
This patch covers the following Core issues: [CWG1862](https://cplusplus.github.io/CWG/issues/1862.html) "Determining “corresponding members” for friendship" [CWG1918](https://cplusplus.github.io/CWG/issues/1918.html) "`friend` templates with dependent scopes" [CWG1945](https://cplusplus.github.io/CWG/issues/1945.html) "Friend declarations naming members of class templates in non-templates" All of them were resolved by CWG1862, where the current wording of [[temp.friend] p5](https://eel.is/c++draft/temp.friend#5) comes from: > A template friend declaration may declare a member of a dependent type to be a friend[.](https://eel.is/c++draft/temp.friend#5.sentence-1) The friend declaration shall declare a function or specify a type with an [elaborated-type-specifier](https://eel.is/c++draft/dcl.type.elab#nt:elaborated-type-specifier), in either case with a [nested-name-specifier](https://eel.is/c++draft/expr.prim.id.qual#nt:nested-name-specifier) ending with a [simple-template-id](https://eel.is/c++draft/temp.names#nt:simple-template-id), C, whose [template-name](https://eel.is/c++draft/temp.names#nt:template-name) names a class template[.](https://eel.is/c++draft/temp.friend#5.sentence-2) The template parameters of the template friend declaration shall be deducible from C ([[temp.deduct.type]](https://eel.is/c++draft/temp.deduct.type))[.](https://eel.is/c++draft/temp.friend#5.sentence-3) In this case, a member of a specialization S of the class template is a friend of the class granting friendship if deduction of the template parameters of C from S succeeds, and substituting the deduced template arguments into the friend declaration produces a declaration that corresponds to the member of the specialization[.](https://eel.is/c++draft/temp.friend#5.sentence-4) A useful example is provided after the paragraph: https://eel.is/c++draft/temp.friend#example-4. Neither of Core issues is implemented, because we don't support dependent nested friend specifiers. --------- Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com>
2024-06-03[clang][analyzer] Move unix.BlockInCriticalSection out of alpha (#93815)Endre Fülöp1-33/+0
After recent improvements (#80029) and testing on open-source projects, the checker is ready to move out of the alpha package.
2024-06-03[clang] Add tests for some CWG issues from 2024-05-31 telecon (#94167)Vlad Serebrennikov1-5/+5
This patch adds tests for some CWG issues that were discussed at 2024-05-31 telecon. While all of them are tentatively ready at the moment, I'm expecting them to be moved to DRs without changes. CWG issues that are expected to have follow-ups are not included in this PR. I also realized that `cwg28xx.cpp` has been testing without `-pedantic-errors`. I fixed that. Fortunately, no existing tests had anything hidden by the lack of this flag. The following CWG issues are covered: [CWG2877](https://cplusplus.github.io/CWG/issues/2877.html) "Type-only lookup for _using-enum-declarator_" [CWG2882](https://cplusplus.github.io/CWG/issues/2882.html) "Unclear treatment of conversion to `void`" [CWG2883](https://cplusplus.github.io/CWG/issues/2883.html) "Definition of "odr-usable" ignores lambda scopes" [CWG2885](https://cplusplus.github.io/CWG/issues/2885.html) "Non-eligible trivial default constructors" [CWG2886](https://cplusplus.github.io/CWG/issues/2886.html) "Temporaries and trivial potentially-throwing special member functions"
2024-06-02[clang][NFC] Update CWG issues listVlad Serebrennikov1-9/+39
2024-05-31[clang] require template arg list after template kw (#80801)Erick Velez1-1/+1
Require a template argument list after an identifier prefixed by the template keyword. Introduced by [CWG 96](https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#96), but the current wording of [[temp.names]p5](https://eel.is/c++draft/temp.names#6) was introduced in [P1787R6](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1787r6.html), and became [temp.names]p6 somewhere else. Fixes #53095 --------- Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com>
2024-05-31[C11] Claim conformance to N1464Aaron Ballman1-1/+1
That's on the CMPLX macros which Clang supports via __builtin_complex.
2024-05-30[clang] CWG150: add tests and change to unreleased (#93758)Matheus Izvekov1-1/+1
2024-05-23Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by ↵yronglin1-1/+1
aggregate initialization using a default member initializer" (#92527) This PR reapply https://github.com/llvm/llvm-project/pull/87933 Signed-off-by: yronglin <yronglin777@gmail.com>
2024-05-22[Clang] Perform derived-to-base conversion on explicit object parameter in ↵Sirraide1-1/+1
lambda (#89828) Consider this code: ```c++ template <typename... Ts> struct Overloaded : Ts... { using Ts::operator()...; }; template <typename... Ts> Overloaded(Ts...) -> Overloaded<Ts...>; void f() { int x; Overloaded o { [&](this auto& self) { return &x; } }; o(); } ``` To access `x` in the lambda, we need to perform derived-to-base conversion on `self` (since the type of `self` is not the lambda type, but rather `Overloaded<(lambda type)>`). We were previously missing this step, causing us to attempt to load the entire lambda (as the base class, it would end up being the ‘field’ with index `0` here), which would then assert later on in codegen. Moreover, this is only valid in the first place if there is a unique and publicly accessible cast path from the derived class to the lambda’s type, so this also adds a check in Sema to diagnose problematic cases. This fixes #87210 and fixes #89541.
2024-05-22Reland "[clang] Enable sized deallocation by default in C++14 onwards" (#90373)Pengcheng Wang1-6/+5
Since C++14 has been released for about nine years and most standard libraries have implemented sized deallocation functions, it's time to make this feature default again. This is another try of https://reviews.llvm.org/D112921. The original commit cf5a8b4 was reverted by 2e5035a due to some failures (see #83774). Fixes #60061
2024-05-20[clang][NFC] Update the list of Core issuesVlad Serebrennikov1-16/+22
2024-05-17[clang] Implement CWG2428 "Deprecating a concept" (#92295)Vlad Serebrennikov1-1/+1
This patch allows attributes to be attached to C++20 concepts, implementing [CWG2428](https://cplusplus.github.io/CWG/issues/2428.html).
2024-05-16Revert "[Clang][CWG1815] Support lifetime extension of temporary created by ↵erichkeane1-1/+1
aggregate initialization using a default member initializer (#87933)" This reverts commit 17daa204feadf9c28fc13b7daa69c3cbe865b238. Multiple examples on the PR https://github.com/llvm/llvm-project/pull/87933 show regressions, so reverting until they can be fixed in the followup.
2024-05-16[clang][NFC] Claim support for P3106R1 since Clang 17Vlad Serebrennikov1-1/+1
Test for this paper were added in https://github.com/llvm/llvm-project/pull/91435
2024-05-16[clang] CTAD: implement the missing IsDeducible constraint for alias ↵Haojian Wu1-2/+2
templates (#89358) Fixes https://github.com/llvm/llvm-project/issues/85192 Fixes https://github.com/llvm/llvm-project/issues/84492 This patch implements the "IsDeducible" constraint where the template arguments of the alias template can be deduced from the returned type of the synthesized deduction guide, per C++ [over.match.class.deduct]p4. In the implementation, we perform the deduction directly, which is more efficient than the way specified in the standard. Also update relevant CTAD tests which were incorrectly compiled due to the missing constraint.
2024-05-15[clang] Add tests for CWG issues regarding completeness of types (#92113)Vlad Serebrennikov1-17/+29
This patch covers the following Core issues: [CWG930](https://cplusplus.github.io/CWG/issues/930.html) "`alignof` with incomplete array type" [CWG1110](https://cplusplus.github.io/CWG/issues/1110.html) "Incomplete return type should be allowed in `decltype` operand" [CWG1340](https://cplusplus.github.io/CWG/issues/1340.html) "Complete type in member pointer expressions" [CWG1352](https://cplusplus.github.io/CWG/issues/1352.html) "Inconsistent class scope and completeness rules" [CWG1458](https://cplusplus.github.io/CWG/issues/1458.html) "Address of incomplete type vs `operator&()`" [CWG1824](https://cplusplus.github.io/CWG/issues/1824.html) "Completeness of return type vs point of instantiation" [CWG1832](https://cplusplus.github.io/CWG/issues/1832.html) "Casting to incomplete enumeration" [CWG2304](https://cplusplus.github.io/CWG/issues/2304.html) "Incomplete type vs overload resolution" [CWG2310](https://cplusplus.github.io/CWG/issues/2310.html) "Type completeness and derived-to-base pointer conversions" [CWG2430](https://cplusplus.github.io/CWG/issues/2430.html) "Completeness of return and parameter types of member functions" [CWG2512](https://cplusplus.github.io/CWG/issues/2512.html) "`typeid` and incomplete class types" [CWG2630](https://cplusplus.github.io/CWG/issues/2630.html) "Syntactic specification of class completeness" [CWG2718](https://cplusplus.github.io/CWG/issues/2718.html) "Type completeness for derived-to-base conversions" [CWG2857](https://cplusplus.github.io/CWG/issues/2857.html) "Argument-dependent lookup with incomplete class types" Current wording for CWG1110 came from [P0135R1](https://wg21.link/p0135R1) "Wording for guaranteed copy elision through simplified value categories". As a drive-by fix, I fixed incorrect status of CWG1815, test for which was added in #87933. CC @yronglin
2024-05-14[Clang][NFC] Mark P2552 as implemented. (#92007)cor3ntin1-1/+1
wg21.link/P2552 suggest that __has_cpp_attribute should return a non-zero value for all attributes that the implementation does something interesting with. Clang does something meaninful with all attributes except for: - no_unique_address which we do not support for msvc target - carries_dependency which arguably does nothing interesting. P2552 shies away from specifying a behavior for that attribute (despite being the only one for which a recommandation would have been interesting, arguably) As such, we have nothing to change for this paper. This paper is a DR and clang always behaved reasonably.
2024-05-13[Clang][CWG1815] Support lifetime extension of temporary created by ↵yronglin1-1/+1
aggregate initialization using a default member initializer (#87933) This PR complete [DR1815](https://wg21.link/CWG1815) under the guidance of `FIXME` comments. And reuse `CXXDefaultInitExpr` rewrite machinery to clone the initializer expression on each use that would lifetime extend its temporaries. --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-05-11[clang] Add test for CWG1820 "Qualified typedef names" (#91765)Vlad Serebrennikov1-1/+1
[P1787R6](https://wg21.link/p1787r6): > [CWG1820](https://cplusplus.github.io/CWG/issues/1820.html) is resolved by requiring that a qualified declarator-id declare an entity. P1787R6 changes wording of [dcl.pre]/9. Quote from the current draft ([[dcl.pre]/5](https://eel.is/c++draft/dcl.pre#5)): > If a [declarator-id](https://eel.is/c++draft/dcl.decl.general#nt:declarator-id) is a name, the [init-declarator](https://eel.is/c++draft/dcl.decl.general#nt:init-declarator) and (hence) the declaration introduce that name[.](https://eel.is/c++draft/dcl.pre#5.sentence-1) > [Note [3](https://eel.is/c++draft/dcl.pre#note-3): Otherwise, the [declarator-id](https://eel.is/c++draft/dcl.decl.general#nt:declarator-id) is a [qualified-id](https://eel.is/c++draft/expr.prim.id.qual#nt:qualified-id) or names a destructor or its [unqualified-id](https://eel.is/c++draft/expr.prim.id.unqual#nt:unqualified-id) is a [template-id](https://eel.is/c++draft/temp.names#nt:template-id) and no name is introduced[.](https://eel.is/c++draft/dcl.pre#5.sentence-2) — end note]
2024-05-10[clang][NFC] Update C++ DR status pageVlad Serebrennikov1-3/+15
2024-05-10[Clang] Implement __reference_converts_from_temporary (#91199)cor3ntin1-9/+1
This completes the required language support for P2255R2.
2024-05-03[Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior ↵cor3ntin1-1/+1
(#90066) https://wg21.link/P2809R3 This is applied as a DR to C++11 (C++98 did not guarantee forward progress and is left untouched) As an extension (and to preserve existing behavior in C), we consider all controlling expression that can be constant folded in the front end, not just standard constant expressions.
2024-05-02[clang] NFC: cxx_status mark P0522R0 as unreleasedMatheus Izvekov1-2/+2
Addressing post-commit review on #89807
2024-05-02[clang] Enable C++17 relaxed template template argument matching by default ↵Matheus Izvekov1-10/+8
(#89807) This patch will finally allow us to mark C++17 support in clang as complete. In order to implement this as a DR and avoid breaking reasonable code that worked before P0522, this patch implements a provisional resolution for CWG2398: When deducing template template parameters against each other, and the argument side names a template specialization, instead of just deducing A, we deduce a synthesized template template parameter based on A, but with it's parameters using the template specialization's arguments as defaults. The driver flag is deprecated with a warning. Fixes https://github.com/llvm/llvm-project/issues/36505
2024-04-30[Clang][NFC] Fix status colorscor3ntin1-2/+2
2024-04-30[NFC][Clang] Update P2718R0 implementation status to partial supported (#90577)yronglin1-2/+9
Once https://github.com/llvm/llvm-project/issues/85613 fixed, we can mark this feature fully supported. Signed-off-by: yronglin <yronglin777@gmail.com>
2024-04-30[clang][analyzer] Move StreamChecker out of the alpha package. (#89247)Balázs Kéri2-73/+0
2024-04-29[Clang] Address post commit feedbacks in #89906 (#90495)cor3ntin1-2/+2
* Fix a leak * Fix a maybe unused warning * Fix incorrect cxx_status entry
2024-04-29[Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a ↵yronglin1-1/+1
Temporary" (#89942) Implement P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" https://wg21.link/P2748R5 --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-04-29[clang] Allow constexpr cast from `void*` in more cases (#89484)offsetof2-27/+57
[[expr.const]/5.14](https://eel.is/c++draft/expr.const#5.14) says that constexpr cast from <code>*cv* void\*</code> to `T*` is OK if the pointee type is similar to `T`, but Clang currently only permits the conversion if the types are the same except top-level cv-qualifiers. This patch also allows casting `(void*)nullptr`, implementing the resolution of [CWG2819](https://cplusplus.github.io/CWG/issues/2819). --------- Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>
2024-04-29[clang] Use `cwg_index.html` from GitHub for DR status page (#90352)Vlad Serebrennikov2-159/+400
Currently we're using official publication of CWG issue list available at https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html. Unfortunately, it's not updated as frequently as we sometimes need. For instance, recently there was a confusion during review of CWG2149 test (https://github.com/llvm/llvm-project/pull/90079#discussion_r1580174003). This patch changes our `make_cxx_dr_status` script to use issue list from CWG GitHub repository. I confirmed with CWG chair that this is the most up-to-date source of information on CWG issues. Changing the source of issue list uncovered previously unhandled "tentatively ready" status of an issue. This status is considered unresolved by the script (like `open`, `drafting`, and `review`), as the resolution might change during face-to-face CWG meeting. I also noticed that CWG decided to handle 2561 differently from what we're doing, so this DR is now considered not available in Clang, despite being declared as available since 18. CC @cor3ntin. This patch also brings new issues into our DR list, so if someone was waiting for a newly-filed issue to appear on our status page, it should appear with this PR.
2024-04-28[Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (#89906)cor3ntin1-1/+1
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0609r3.pdf We support this feature in all language mode. maybe_unused applied to a binding makes the whole declaration unused.
2024-04-26Revert "[clang] Enable sized deallocation by default in C++14 onwards ↵Vitaly Buka1-5/+6
(#83774)" (#90299) https://lab.llvm.org/buildbot/#/builders/168/builds/20063 (should be fixed with #90292) More details in #83774 This reverts commit cf5a8b489464d09dfdd7a48ce7c8b41d3c9bf819.
2024-04-26[clang] Add test for CWG2149 "Brace elision and array length deduction" (#90079)Vlad Serebrennikov1-1/+1
This patch adds test for [CWG2149](https://cplusplus.github.io/CWG/issues/2149.html), following [P3106R1](https://wg21.link/p3106R1) "Clarifying rules for brace elision in aggregate initialization" and a clarification note on top of it added on April 2024. I haven't found a better way to check for equality of values inside array in 98 mode than to dump AST. I'm open to suggestions there.
2024-04-26[clang] Enable sized deallocation by default in C++14 onwards (#83774)Pengcheng Wang1-6/+5
Since C++14 has been released for about nine years and most standard libraries have implemented sized deallocation functions, it's time to make this feature default again. This is another try of https://reviews.llvm.org/D112921. Fixes #60061
2024-04-17[C99] Remove WG14 N522 from the C status pageAaron Ballman1-5/+0
This paper is about type compatibility rules that changed in C99, but this is only applicable across translation units and so there's nothing for us to test. The specific change was that C89 allowed different tag types (e.g., struct and union) to be compatible and C99 tightened that restriction. This is a case where the user gets whatever they get if they link two TUs with incompatible tag types.
2024-04-14[Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (#86526)Sirraide1-1/+1
This implements support for the `= delete("message")` syntax that was only just added to C++26 ([P2573R2](https://isocpp.org/files/papers/P2573R2.html#proposal-scope)).
2024-04-13[clang][NFC] Replace `dr` with `cwg` in DR test suiteVlad Serebrennikov1-3/+3
This patch is breaking `dr` to `cwg` equivalence in our terminology, making room for tests for LWG issues that concern compiler intrinsics.
2024-04-12[C99] Claim conformance for _Complex support (#88161)Aaron Ballman1-22/+15
There's so much overlap between the cited papers so this condenses the status page into a single entry rather than trying to test conformance against multiple papers doing conflicting things.