1810 Commits

Author SHA1 Message Date
Corentin Jabot
47ccfd7a89 [Clang] Implement P2741R3 - user-generated static_assert messages
Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D154290
2023-07-20 08:33:19 +02:00
Po-yao Chang
5ce5e983f8 [Clang] Add warnings for CWG2521
1. Teach -Wuser-defined-literals to warn on using double underscores in
   literal suffix identifiers.
2. Add -Wdeprecated-literal-operator to warn about the use of the first
   grammar production of literal-operator-id, which defaults to off for now.

Differential Revision: https://reviews.llvm.org/D152632
2023-07-19 07:23:34 +08:00
Vlad Serebrennikov
1bbaabb90d [clang] Add test for CWG1710 and related issues
Those issues focus on `template` keyword being optional in certain type-only contexts (base specifiers, member initializers, typename specifiers), as opposed to be disallowed by the grammar, or required by some implementations. GCC accepts all the tests this patch touches since 10, others fail on various tests: https://godbolt.org/z/1M6KE3W1a

It should be noted that the wording in [[ https://cplusplus.github.io/CWG/issues/1710.html | 1710 ]] that resolves those issues has been substantially changed by [[ https://wg21.link/p1787 | P1787 ]]. I can't find the post-P1787 wording that covers those issues, but I can't find the intent of changing relevant behavior in P1787 either, so I assume that intent of the 1710 resolution is preserved somewhere.

This patch covers the following issues:
[[ https://cplusplus.github.io/CWG/issues/314.html  | CWG314 ]]
[[ https://cplusplus.github.io/CWG/issues/343.html  | CWG343 ]]
[[ https://cplusplus.github.io/CWG/issues/1710.html | CWG1710 ]]
[[ https://cplusplus.github.io/CWG/issues/1794.html | CWG1794 ]]
[[ https://cplusplus.github.io/CWG/issues/1812.html | CWG1812 ]]

Reviewed By: #clang-language-wg, cor3ntin

Differential Revision: https://reviews.llvm.org/D151697
2023-07-11 16:24:39 +03:00
Aaron Ballman
9c96cc96e3 Clang 17 isn't not yet released; NFC 2023-07-10 14:28:22 -04:00
cor3ntin
d54cad7985
[Clang][NFC] Mark that P2280 was approved as a DR 2023-07-07 16:36:47 +02:00
Corentin Jabot
95f50964fb Implement P2361 Unevaluated string literals
This patch proposes to handle in an uniform fashion
the parsing of strings that are never evaluated,
in asm statement, static assert, attrributes, extern,
etc.

Unevaluated strings are UTF-8 internally and so currently
behave as narrow strings, but these things will diverge with
D93031.

The big question both for this patch and the P2361 paper
is whether we risk breaking code by disallowing
encoding prefixes in this context.
I hope this patch may allow to gather some data on that.

Future work:
Improve the rendering of unicode characters, line break
and so forth in static-assert messages

Reviewed By: aaron.ballman, shafik

Differential Revision: https://reviews.llvm.org/D105759
2023-07-07 13:30:27 +02:00
Mital Ashok
92f4bf2689 Fix aggregate CTAD with string literals adding extra const
Missing a `withConst`, so when deducing from a string literal, a `const` is erroneously added to the deduced type.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D154301
2023-07-05 11:54:51 -07:00
Mariya Podchishchaeva
4a792e06e8 [clang] Fix new-expression with elaborated-type-specifier
Expressions like
```
struct A {};
...
new struct A {};
struct A* b = (1 == 1) ? new struct A : new struct A;

```
were parsed as redefinitions of `struct A` and failed, however as clarified by
`CWG2141` new-expression cannot define a type, so both these examples
should be considered as references to the previously declared `struct A`.
The patch adds a "new" kind context for parsing declaration specifiers in
addition to already existing declarator context in order to track that
the parser is inside of a new expression.

Fixes https://github.com/llvm/llvm-project/issues/34341

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D153857
2023-07-03 06:07:04 -04:00
Yuanfang Chen
e5cc56a0d1 [clang] Update cxx_status for 632dd6a4ca0036009f
missed this after rebase
2023-06-30 09:10:33 -07:00
Corentin Jabot
f27afedc6c [Clang] Implement P2738R1 - constexpr cast from void*
Reviewed By: #clang-language-wg, erichkeane

Differential Revision: https://reviews.llvm.org/D153702
2023-06-26 16:45:07 +02:00
Corentin Jabot
f2a352e058 [Clang] Add the list of core papers approved in Varna to the status page 2023-06-17 09:52:36 +03:00
Mariya Podchishchaeva
bba6ea8c2d [C++20] Claim full support for consteval again
After resolving several outstanding issues now is the time to mark it as
fully supported.

Fixes https://github.com/llvm/llvm-project/issues/57094

Reviewed By: aaron.ballman, cor3ntin, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D147717
2023-06-13 03:50:24 -04:00
Corentin Jabot
4676885270 [clang] Implement P2564 "consteval must propagate up"
Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D151094
2023-06-07 20:45:36 +02:00
Jens Massberg
593a2740f7 [clang] Show error if defaulted comparions operator function is volatile or has ref-qualifier &&.
This patch implemed the change proposed in [P2002R1] to 11.11.1 [class.compare.default] paragraph 1.

A defaulted compariosn operator function must be non-volatile and must either have no ref-qualifier or the ref-qualifier &.

Differential Revision: https://reviews.llvm.org/D148924
2023-06-07 12:56:35 +02:00
Aaron Ballman
920aa39568 Switch from full to unreleased for a Clang 17 fix; NFC 2023-06-06 08:58:31 -04:00
Corentin Jabot
684f3c968d [Clang] Fix status of P0960
P0960R3 and P1975R0 were marked not implemented because
of #61145,

This issue has been fixed and backported to LLVM 16,
the status page should reflect that.

Reviewed By: #clang-language-wg, ayzhao, erichkeane

Differential Revision: https://reviews.llvm.org/D150122
2023-06-03 17:03:42 +02:00
Vlad Serebrennikov
238f15820e [clang] Add test for CWG873
Also add missing marking to the test of related issue 621.

https://cplusplus.github.io/CWG/issues/621.html
https://cplusplus.github.io/CWG/issues/873.html

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D151704
2023-05-31 10:17:27 +03:00
Vlad Serebrennikov
9c561e8f3c [clang] Add test for CWG1397
Resolution of this CWG breaks potential dependency loop between complete-class context of non-static data member initializer (NSDMI), and defaulted default constructor, which is `noexcept` depending on NSDMIs among other things.

For whatever reason in C++11 mode we issue an additional note and a different line number for the primary error. But I find the message itself even worse than aforementioned issues. It describes what's going on, but doesn't say what's bad about it. I find the previous version of this message more clear: 8dbc6b2617 . Created an issue for that: #62823

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D151034
2023-05-30 12:09:02 +03:00
Vlad Serebrennikov
5b4fed66ef [clang][NFC] Update latest released Clang versions in make_cxx_dr_status
This changes a handful of recently implemented DRs from "unreleased" to "full" styling in cxx_dr_status.html
2023-05-28 15:58:52 +03:00
Aaron Ballman
b46be151d2 Publicly document the C & C++ Language WG meetings
We've been hosting these meetings regularly for a while now, so this
begins advertising the meetings more widely.
2023-05-24 13:39:18 -04:00
Vlad Serebrennikov
1c5a749754 Reland "[clang] Add tests for CWG issues 977, 1482, 2516"
Now with support for MSVC-specific triples.

CWG977 focus on point of /completeness/ of enums. Wording provided in CWG1482.
CWG1482 and CWG2516 focus on locus (point) of /declaration/. Wording provided in CWG2516.

Reviewed By: clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D151042
2023-05-23 21:04:23 +03:00
Vlad Serebrennikov
70688e82e2 Revert "[clang] Add tests for CWG issues 977, 1482, 2516"
This reverts commit 85452b5f9b5aba5bdf0259b7f0d7400362f95535.
2023-05-23 15:29:14 +03:00
Vlad Serebrennikov
85452b5f9b [clang] Add tests for CWG issues 977, 1482, 2516
CWG977 focus on point of /completeness/ of enums. Wording provided in CWG1482.
CWG1482 and CWG2516 focus on locus (point) of /declaration/. Wording provided in CWG2516.

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D151042
2023-05-23 12:50:42 +03:00
Vlad Serebrennikov
71bc3dd42e [clang] Add test for CWG2213
[[https://wg21.link/p1787 | P1787]]: CWG2213 is resolved by allowing an elaborated-type-specifier to contain a simple-template-id without friend.
Wording: see changes to [dcl.type.elab]]/1.

The gist of the issue is that forward declaration of partial class template specialization was disallowed.

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D151032
2023-05-23 12:44:24 +03:00
Tobias Hieta
dd3c26a045
[NFC][Py Reformat] Reformat python files in clang and clang-tools-extra
This is an ongoing series of commits that are reformatting our
Python code.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: MatzeB

Differential Revision: https://reviews.llvm.org/D150761
2023-05-23 08:29:52 +02:00
Vlad Serebrennikov
14f245d01a [clang] Add test for CWG399
[[https://wg21.link/p1787 | P1787]]: CWG399 is resolved by explicitly appealing to the lookup for the last component of any suitable nested-name-specifier.
Wording: Otherwise, its nested-name-specifier N shall nominate a type. If N has another nested-name-specifier S, Q is looked up as if its lookup context were that nominated by S. ([basic.lookup.qual]/6.2)

CWG399 revisits a resolution to older CWG244. Our test for CWG244 covers many examples from CWG399, and it was updated in 2020 presumably aware of P1787, so I reused CWG244 test. This approach to reusing was discussed in [[https://reviews.llvm.org/D139095 | a CWG405 patch review]].

Reviewed By: #clang-language-wg, aaron.ballman, shafik

Differential Revision: https://reviews.llvm.org/D147920
2023-05-20 11:17:44 +03:00
Aaron Ballman
d02d054473 Clean up Clang's index page slightly
Set the charset to UTF-8, link to the actual liscense we used,
claim support for targets LLVM supports instead of listing them
manually, and stop listing individual language standards we support.
2023-05-18 12:37:53 -04:00
Aaron Ballman
0e85260db1 Removed outdated information from Clang's webpage menu
This removes the link to Planet Clang as well as the LLVM coverage
reports, as neither has been actively worked on for several years.
2023-05-18 12:23:29 -04:00
Aaron Ballman
153d9b9371 Remove unreferenced files from Clang's website
None of these files are referenced by anything else on the website, and
the content for these files is quite dated or experiments that did not
pan out. I used a few search engines to see if others were linking to
this content (esp the libstdc++ patches) and did not find significant
evidence that they were.
2023-05-18 11:53:27 -04:00
Corentin Jabot
b9c0e590f1 [Clang][NFC] Present language version in descending publication date 2023-05-16 08:52:44 +02:00
Erich Keane
b763d6a4ed Add C++26 compile flags.
Now that we've updated to C++23, we need to add C++26/C++2c command line
flags, as discussed in
https://discourse.llvm.org/t/rfc-lets-just-call-it-c-26-and-forget-about-the-c-2c-business-at-least-internally/70383

Differential Revision: https://reviews.llvm.org/D150450
2023-05-15 08:56:16 -07:00
Kazu Hirata
2db0812882 [clang] Fix typos in documentation 2023-05-12 23:19:17 -07:00
Ilya Biryukov
629170fe45 [Sema] Lambdas are not part of immediate context for deduction
This commit implements [temp.deduct]p9.
Test updates include:
- New notes in `cxx1y-init-captures.cpp`, `lambda-expressions.cpp`
  and 'warn-unused-lambda-capture.cpp'.
  This seems to be caused by diagnosing errors earlier (during
  deduction) that were previously surfaced later (during
  instantiation).
- New error `lambda-unevaluated.cpp` is in line with [temp.deduct]p9.

Reviewed By: erichkeane, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D148802
2023-05-09 12:06:33 +02:00
Shafik Yaghmour
b4692f2926 [Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2
Prior to P2448R2 we were more aggressive in diagnosing ill-formed
constexpr functions. Many of these restrictions were relaxed and now it
is not required for defaulted comparison operators to call constexpr
functions.

This behavior is extended to before C++23 and diagnostic for it's use
can be enabled w/ -pedantic or -Wc++2b-default-comp-relaxed-constexpr

This fixes: https://github.com/llvm/llvm-project/issues/61238

Differential Revision: https://reviews.llvm.org/D146090
2023-05-04 11:07:16 -07:00
Mark de Wever
ba15d186e5 [clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149553
2023-05-04 19:19:52 +02:00
Aaron Ballman
398403259a Add the experiemental interpreter to the open project page
This also fixes a missing close li tag as a drive-by
2023-05-04 09:41:25 -04:00
Aaron Ballman
9bb28a18d9 [C2x] Update 'nullptr' implementation based on CD comments
We filed some CD ballot comments which WG14 considered during the
ballot comment resolution meetings in Jan and Feb 2023, and this
updates our implementation based on the decisions reached. Those
decisions were (paraphrased for brevity):

US 9-034 (REJECTED)
  allow (void *)nullptr to be a null pointer constant
US 10-035 (ACCEPTED)
  accept the following code, as in C++:
  void func(nullptr_t); func(0);
US 22-058 (REJECTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(1 ? val : 0); (void)(1 ? nullptr : 0);
US 23-062 (REJECTED)
  reject the following code, as in C++:
  nullptr_t val; bool b1 = val; bool b2 = nullptr;
US 24-061 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; val = 0;
US 21-068 (ACCEPTED)
  accept the following code, as in C++:
  (nullptr_t)nullptr;
GB-071 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(val == nullptr);

This patch updates the implementation as appropriate, but is primarily
focused around US 10-035, US 24-061, and US 23-062 in terms of
functional changes.

Differential Revision: https://reviews.llvm.org/D148800
2023-05-03 14:50:15 -04:00
Shivam Gupta
a704854938 [Clang][Doc] Added an open project for improving command line docs
There seems to be a lot of documentation is missing
for different command line flags uses.
This create confusion with same looking options, better to
document clearly their uses.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149405
2023-04-28 23:32:37 +05:30
Tom Honermann
a68039c51e [Clang] Add tests and mark as implemented WG14-N2728
This change expands testing of UTF-8, UTF-16, and UTF-32 character and string
literals as validation that WG14 N2728 (char16_t & char32_t string literals
shall be UTF-16 & UTF-32) has been implemented.

Reviewed By: cor3ntin, aaron.ballman

Differential Revision: https://reviews.llvm.org/D149098
2023-04-27 14:25:41 -07:00
Vlad Serebrennikov
5cda0d165a [clang] Add test for CWG1821
[[https://wg21.link/p1787 | P1787]]: My clarification in [[ http://lists.isocpp.org/core/2019/06/6614.php | “Where can namespace-scope functions and variables be redeclared?” ]] is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression in a declarator-id is a qualified-id Q, let S be its lookup context; the declaration shall inhabit a namespace scope. ([dcl.meaning]/1)

Reviewed By: shafik, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D149003
2023-04-25 09:03:46 +03:00
Aaron Ballman
8eea50c7c5 Add missing HTML closing tag
The </li> tag was missing for this entry.
2023-04-24 11:58:50 -04:00
Aaron Ballman
d64811f976 Remove the "implement better version of existing tools" open project
This project doesn't really relate to improving Clang itself and it
contained stale suggestions like working on code modification
functionality in clang-format.
2023-04-24 11:56:25 -04:00
Aaron Ballman
5259ff7f0a Reword the open project for generating documentation
Work already began on this project, so this updates the wording to
discuss clang-doc specifically.
2023-04-24 11:55:11 -04:00
Aaron Ballman
6e696b12b7 Add some more open project for Clang
This adds open projects for updating the status of our C conformance,
DR conformance for both C and C++, and improving build times.
2023-04-24 11:44:27 -04:00
Aaron Ballman
f0630a37b6 Add some open projects for people to consider
These projects are ones that are already known within the community as
areas we would like to see improvements on.
2023-04-24 10:54:32 -04:00
Aaron Ballman
5e10cd7878 Remove known-stale projects from the open projects page
This removes or modifies:

Undefined behavior checking -- we've got UBSan and it's well-known
enough that we don't need to call it out specifically as a need.

Improve target support -- this is largely already complete.

Use clang libraries to extend Ragel with a JIT -- this wasn't really
related to improving Clang.

C++1y feature work -- now talks about C++20, C++2b, and C2x instead.

Universal driver -- the bug report linked to by the UniversalDriver
web page has been closed since 2017.

XML representation of the AST -- we removed this functionality in 2013
and replaced it with a JSON representation a few years later. That is a
best-effort project.
2023-04-24 08:58:56 -04:00
Aaron Ballman
039c356cda Minor cleanup of the Open Projects page
Sets the charset to UTF-8, fixes the page title, replaces mention of
cfe-dev with Discourse, points out Discord and IRC.
2023-04-24 08:27:09 -04:00
Vlad Serebrennikov
0a113c4c50 [clang] Mark CWG2009 as N/A
[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions. The rest of CWG2009 is resolved by making it ill-formed NDR for forward lookup outside a complete-class context to change the results (before overload resolution, to avoid differences in instantiation).
Wording: The result of the search is the declaration set of S(N, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required. ([class.member.lookup]/7)

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D148263
2023-04-24 11:53:04 +03:00
Vlad Serebrennikov
19ef8e8446 [clang] Mark CWG2331 as N/A
[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions.
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. ([class.member.lookup]/4)

Reviewed By: #clang-language-wg, shafik

Differential Revision: https://reviews.llvm.org/D148260
2023-04-15 13:15:45 +03:00
Vlad Serebrennikov
576c752410 [clang] Add test for CWG1894 and CWG2199
[[https://wg21.link/p1787 | P1787]]: CWG1894 and its duplicate CWG2199 are resolved per Richard’s proposal for [[ https://listarchives.isocpp.org/cgi-bin/wg21/message?wg=core&msg=28415 | “dr407 still leaves open questions about typedef / tag hiding” ]], using generic conflicting-declaration rules even for typedef, and discarding a redundant typedef-name when looking up an elaborated-type-specifier.
Wording: See changes to [dcl.typedef], [basic.lookup.elab], and [basic.lookup]/4.

Generic conflicting-declaration rules are specified in changes to [basic.scope.scope]. [[ https://cplusplus.github.io/CWG/issues/407.html | CWG407]], [[ https://cplusplus.github.io/CWG/issues/1894.html | CWG1894 ]], and [[ https://cplusplus.github.io/CWG/issues/2199.html | CWG2199 ]] discuss how elaborated type specifiers interact with typedefs, using directives, and using declarations. Since existing test for CWG407 covers examples provided in CWG1894 and CWG2199, and does it in accordance with P1787, I reused parts of it.

Reviewed By: #clang-language-wg, cor3ntin

Differential Revision: https://reviews.llvm.org/D148136
2023-04-14 10:15:21 +03:00