#
abc8812d |
| 29-Jan-2025 |
Jason Rice <ricejasonf@gmail.com> |
[Clang][P1061] Add stuctured binding packs (#121417)
This is an implementation of P1061 Structure Bindings Introduce a Pack without the ability to use packs outside of templates. There is a couple o
[Clang][P1061] Add stuctured binding packs (#121417)
This is an implementation of P1061 Structure Bindings Introduce a Pack without the ability to use packs outside of templates. There is a couple of ways the AST could have been sliced so let me know what you think. The only part of this change that I am unsure of is the serialization/deserialization stuff. I followed the implementation of other Exprs, but I do not really know how it is tested. Thank you for your time considering this.
---------
Co-authored-by: Yanzuo Liu <zwuis@outlook.com>
show more ...
|
Revision tags: llvmorg-21-init |
|
#
4bd2307a |
| 28-Jan-2025 |
Timm Baeder <tbaeder@redhat.com> |
[clang][ExprConst] Don't diagnose a non-existent init as not constant (#124575)
This test: ```c++ extern Swim& trident; // expected-note {{declared here}}
constexpr auto& gallagher = typeid(trident
[clang][ExprConst] Don't diagnose a non-existent init as not constant (#124575)
This test: ```c++ extern Swim& trident; // expected-note {{declared here}}
constexpr auto& gallagher = typeid(trident); // expected-error {{constexpr variable 'gallagher' must be initialized by a constant expression}} // expected-note@-1 {{initializer of 'trident' is not a constant expression}} ``` diagnosed the initializer of `trident` as not constant, but `trident` doesn't even have an initializer. Remove that diagnostic in this case.
show more ...
|
#
c9637afe |
| 26-Jan-2025 |
Shafik Yaghmour <shafik.yaghmour@intel.com> |
[Clang] Fix createConstexprUnknownAPValues to use zero offset when ceating APValue (#124478)
When implmenting P2280R4 here:
https://github.com/llvm/llvm-project/pull/95474
When creating the APVa
[Clang] Fix createConstexprUnknownAPValues to use zero offset when ceating APValue (#124478)
When implmenting P2280R4 here:
https://github.com/llvm/llvm-project/pull/95474
When creating the APValue to store and constexprUnknown value I used an
offset of CharUnits::One() but it should have been CharUnits::Zero().
This change just adjusts that value.
show more ...
|
#
886adf8f |
| 24-Jan-2025 |
Timm Baeder <tbaeder@redhat.com> |
[clang][ExprConst] Let diagnostics point to std::allocator calls (#123744)
Instead of the underlying operator new calls. This fixes a longstanding FIXME comment in cxx2a-constexpr-dynalloc.cpp.
|
#
0a9c08c5 |
| 22-Jan-2025 |
Shafik Yaghmour <shafik.yaghmour@intel.com> |
[Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (#95474)
P2280R4 allows the use of references in pointers of unknown origins in a constant expression context
[Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (#95474)
P2280R4 allows the use of references in pointers of unknown origins in a constant expression context but only in specific cases that could be constant expressions.
We track whether a variable is a constexpr unknown in a constant expression by setting a flag in either APValue or LValue and using this flag to prevent using unknown values in places where it is not allowed.
Fixes: https://github.com/llvm/llvm-project/issues/63139 https://github.com/llvm/llvm-project/issues/63117
show more ...
|
Revision tags: llvmorg-19.1.7 |
|
#
cfe26358 |
| 11-Jan-2025 |
Timm Baeder <tbaeder@redhat.com> |
Reapply "[clang] Avoid re-evaluating field bitwidth" (#122289)
|
#
fd6baa47 |
| 09-Jan-2025 |
Timm Baeder <tbaeder@redhat.com> |
[clang][ExprConst] Add diagnostics for invalid binary arithmetic (#118475)
... between unrelated declarations or literals.
Leaving this small (I haven't run the whole test suite locally) to get som
[clang][ExprConst] Add diagnostics for invalid binary arithmetic (#118475)
... between unrelated declarations or literals.
Leaving this small (I haven't run the whole test suite locally) to get some feedback on the wording and implementation first.
The output of the sample in https://github.com/llvm/llvm-project/issues/117409 is now: ```console ./array.cpp:57:6: warning: expression result unused [-Wunused-value] 57 | am - aj.af(); | ~~ ^ ~~~~~~~ ./array.cpp:70:8: error: call to consteval function 'L::L<bx>' is not a constant expression 70 | q(0, [] { | ^ ./array.cpp:57:6: note: arithmetic on addresses of literals has unspecified value 57 | am - aj.af(); | ^ ./array.cpp:62:5: note: in call to 'al(&""[0], {&""[0]})' 62 | al(bp.af(), k); | ^~~~~~~~~~~~~~ ./array.cpp:70:8: note: in call to 'L<bx>({})' 70 | q(0, [] { | ^~~~ 71 | struct bx { | ~~~~~~~~~~~ 72 | constexpr operator ab<g<l<decltype(""[0])>::e>::e>() { return t(""); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | }; | ~~ 74 | return bx(); | ~~~~~~~~~~~~ 75 | }()); | ~~~ ```
The output for ```c++ int a, b; constexpr int n = &b - &a ```
is now: ```console ./array.cpp:80:15: error: constexpr variable 'n' must be initialized by a constant expression 80 | constexpr int n = &b - &a; | ^ ~~~~~~~ ./array.cpp:80:22: note: arithmetic involving '&b' and '&a' has unspecified value 80 | constexpr int n = &b - &a; | ^ 1 error generated.
```
show more ...
|
#
59bdea24 |
| 08-Jan-2025 |
Timm Bäder <tbaeder@redhat.com> |
Revert "[clang] Avoid re-evaluating field bitwidth (#117732)"
This reverts commit 81fc3add1e627c23b7270fe2739cdacc09063e54.
This breaks some LLDB tests, e.g. SymbolFile/DWARF/x86/no_unique_address-
Revert "[clang] Avoid re-evaluating field bitwidth (#117732)"
This reverts commit 81fc3add1e627c23b7270fe2739cdacc09063e54.
This breaks some LLDB tests, e.g. SymbolFile/DWARF/x86/no_unique_address-with-bitfields.cpp:
lldb: ../llvm-project/clang/lib/AST/Decl.cpp:4604: unsigned int clang::FieldDecl::getBitWidthValue() const: Assertion `isa<ConstantExpr>(getBitWidth())' failed.
show more ...
|
#
81fc3add |
| 08-Jan-2025 |
Timm Baeder <tbaeder@redhat.com> |
[clang] Avoid re-evaluating field bitwidth (#117732)
Save the bitwidth value as a `ConstantExpr` with the value set. Remove the `ASTContext` parameter from `getBitWidthValue()`, so the latter simply
[clang] Avoid re-evaluating field bitwidth (#117732)
Save the bitwidth value as a `ConstantExpr` with the value set. Remove the `ASTContext` parameter from `getBitWidthValue()`, so the latter simply returns the value from the `ConstantExpr` instead of constant-evaluating the bitwidth expression every time it is called.
show more ...
|
#
dc3cd2e9 |
| 04-Jan-2025 |
Chandler Carruth <chandlerc@gmail.com> |
Factor common code for quoting a builtin name (#120835)
This shows up in several places in order to match the quoting of other
uses of the same diagnostic. Handling it centrally simplifies the code
Factor common code for quoting a builtin name (#120835)
This shows up in several places in order to match the quoting of other
uses of the same diagnostic. Handling it centrally simplifies the code
and reduces changes if the storage for builtin names changes.
This refactoring is extracted out of #120534 as requested in code
review.
show more ...
|
#
dd577c05 |
| 23-Dec-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in reduce min/max function. (#120866)
Part of #51787.
This patch adds constexpr support for the built-in reduce min/max function.
|
Revision tags: llvmorg-19.1.6 |
|
#
502c08e6 |
| 10-Dec-2024 |
Timm Baeder <tbaeder@redhat.com> |
[clang][ExprConst] Move vector diagnostics to checkBitCastConstexprEl… (#119366)
…igibilityType
This is the function we use to diagnose invalid types, so use it for those checks as well.
NFC.
|
#
b0f8f32f |
| 10-Dec-2024 |
Timm Baeder <tbaeder@redhat.com> |
[ExprConst] Handle floating- and char literals in FastEvaluateAsRValue (#118294)
This is part of a three-patch series that results in some nice (but not substantial) compile-time improvements: http:
[ExprConst] Handle floating- and char literals in FastEvaluateAsRValue (#118294)
This is part of a three-patch series that results in some nice (but not substantial) compile-time improvements: http://llvm-compile-time-tracker.com/compare.php?from=fe1c4f0106fe4fd6d61c38ba46e71fda8f4d1573&to=0824d621b2c035a3befb564153b31309a9a79d97&stat=instructions%3Au
The results for just this patch are here: http://llvm-compile-time-tracker.com/compare.php?from=fe1c4f0106fe4fd6d61c38ba46e71fda8f4d1573&to=6f7f51b476a37dc7c80427fede077e6798a83be8&stat=instructions:u
show more ...
|
#
1094641b |
| 09-Dec-2024 |
Oleksandr T. <oleksandr.tarasiuk@outlook.com> |
[Clang] allow usage of placement new operator in [[msvc::constexpr]] context outside of the std namespace (#119153)
Fixes #74924
|
#
f145ff3f |
| 09-Dec-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in elementwise add_sat/sub_sat functions. (#119082)
Part of #51787.
This patch adds constexpr support for the built-in elementwise add_sat
and sub_sat functions.
|
Revision tags: llvmorg-19.1.5 |
|
#
814ed93e |
| 03-Dec-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in elementwise bitreverse function. (#118177)
Part of #51787.
This patch adds constexpr support for the built-in elementwise
bitreverse function.
|
#
827ebf84 |
| 26-Nov-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in elementwise popcount function. (#117473)
Part of #51787.
This patch adds constexpr support for the built-in elementwise popcount
function.
|
#
cbdd14ee |
| 24-Nov-2024 |
Congcong Cai <congcongcai0907@163.com> |
[clang][NFC]add static for internal linkage function (#117482)
Detected by misc-use-internal-linkage
|
#
685e41e7 |
| 21-Nov-2024 |
Timm Baeder <tbaeder@redhat.com> |
[clang][ExprConst] Reject field access with nullptr base (#113885)
Reject them if the base is null, not only if the entire pointer is null.
Fixes #113821
|
#
ddb62d26 |
| 21-Nov-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in reduce `or` and `xor` function. (#116976)
Part of #51787.
Follow up of #116822.
This patch adds constexpr support for the built-in reduce `or` and `xor`
functions.
|
#
af0e0ded |
| 20-Nov-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in reduce and function. (#116822)
Part of #51787.
Follow up of #116626.
This patch adds constexpr support for the built-in reduce and function.
|
#
b03a747f |
| 19-Nov-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in reduce mul function. (#116626)
Part of #51787.
Follow up of #116243.
This patch adds constexpr support for the built-in reduce mul function.
|
Revision tags: llvmorg-19.1.4 |
|
#
1e4646d8 |
| 18-Nov-2024 |
c8ef <c8ef@outlook.com> |
[clang] constexpr built-in reduce add function. (#116243)
Part of #51787.
This patch adds constexpr support for the built-in reduce add function.
If this is the right way to go, I will add supp
[clang] constexpr built-in reduce add function. (#116243)
Part of #51787.
This patch adds constexpr support for the built-in reduce add function.
If this is the right way to go, I will add support for other reduce
functions in later patches.
---------
Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
show more ...
|
#
dec6324c |
| 17-Nov-2024 |
Kazu Hirata <kazu@google.com> |
[AST] Remove unused includes (NFC) (#116549)
Identified with misc-include-cleaner.
|
Revision tags: llvmorg-19.1.3 |
|
#
61a456bd |
| 24-Oct-2024 |
Oleksandr T. <oleksandr.tarasiuk@outlook.com> |
[Clang] prevent assertion failure in value-dependent initializer expressions (#112612)
Fixes #112140
---
```
CXXConstructExpr 0x14209e580 'const S':'const struct S' contains-errors 'void (co
[Clang] prevent assertion failure in value-dependent initializer expressions (#112612)
Fixes #112140
---
```
CXXConstructExpr 0x14209e580 'const S':'const struct S' contains-errors 'void (const int &)' list
`-CXXDefaultArgExpr 0x14209e500 'const int' contains-errors
`-RecoveryExpr 0x14209daf0 'const int' contains-errors
```
This change resolves an issue with evaluating `ArrayFiller` initializers
in _dependent_ contexts, especially when they involve a `RecoveryExpr`.
In certain cases, `ArrayFiller` initializers containing a `RecoveryExpr`
from earlier errors are incorrectly passed to `EvaluateInPlace`, causing
evaluation failures when they are value-dependent.
When this is the case, the initializer is processed through
`EvaluateDependentExpr`, which prevents unnecessary evaluation attempts
and ensures proper handling of value-dependent initializers in
`ArrayFillers`.
show more ...
|