Age | Commit message (Collapse) | Author | Files | Lines |
|
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)
|
|
|
|
|
|
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
|
|
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.
|
|
and Obj-C++ by-proxy)" (#95299)
Reverts llvm/llvm-project#68620
Introduce or expose a memory leak and UB, see llvm/llvm-project#68620
|
|
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`.
|
|
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>
|
|
|
|
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>
|
|
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.
|
|
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>
|
|
After recent improvements (#80029) and testing on open-source projects,
the checker is ready to move out of the alpha package.
|
|
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"
|
|
|
|
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>
|
|
That's on the CMPLX macros which Clang supports via __builtin_complex.
|
|
|
|
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>
|
|
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.
|
|
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
|
|
|
|
This patch allows attributes to be attached to C++20 concepts,
implementing
[CWG2428](https://cplusplus.github.io/CWG/issues/2428.html).
|
|
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.
|
|
Test for this paper were added in https://github.com/llvm/llvm-project/pull/91435
|
|
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.
|
|
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
|
|
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.
|
|
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>
|
|
[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]
|
|
|
|
This completes the required language support for P2255R2.
|
|
(#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.
|
|
Addressing post-commit review on #89807
|
|
(#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
|
|
|
|
Once https://github.com/llvm/llvm-project/issues/85613 fixed, we can
mark this feature fully supported.
Signed-off-by: yronglin <yronglin777@gmail.com>
|
|
|
|
* Fix a leak
* Fix a maybe unused warning
* Fix incorrect cxx_status entry
|
|
Temporary" (#89942)
Implement P2748R5 "Disallow Binding a Returned Glvalue to a Temporary"
https://wg21.link/P2748R5
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
|
|
[[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>
|
|
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.
|
|
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.
|
|
(#83774)" (#90299)
https://lab.llvm.org/buildbot/#/builders/168/builds/20063 (should be
fixed with #90292)
More details in #83774
This reverts commit cf5a8b489464d09dfdd7a48ce7c8b41d3c9bf819.
|
|
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.
|
|
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
|
|
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.
|
|
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)).
|
|
This patch is breaking `dr` to `cwg` equivalence in our terminology, making room for tests for LWG issues that concern compiler intrinsics.
|
|
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.
|