#
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, llvmorg-19.1.7 |
|
#
41a94de7 |
| 13-Jan-2025 |
Maksim Ivanov <emaxx@google.com> |
[clang] Refactor attr diagnostics to use %select (#122473)
A cleanup follow-up to #118501 and #118567.
|
#
6b122723 |
| 10-Jan-2025 |
Maksim Ivanov <emaxx@google.com> |
[clang] Informative error for lifetimebound in decl-spec (#118567)
Emit a bit more informative error when the `[[clang::lifetimebound]]`
attribute is wrongly appearing on a decl-spec:
```
'life
[clang] Informative error for lifetimebound in decl-spec (#118567)
Emit a bit more informative error when the `[[clang::lifetimebound]]`
attribute is wrongly appearing on a decl-spec:
```
'lifetimebound' attribute only applies to parameters and implicit
object parameters
```
instead of:
```
'lifetimebound' attribute cannot be applied to types
```
The new error is also consistent with the diagnostic emitted when the
attribute is misplaced in other parts of a declarator.
show more ...
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5 |
|
#
54fcf3ec |
| 02-Dec-2024 |
antangelo <contact@antangelo.com> |
[clang] Implement P3176R1: The Oxford variadic comma (#117524)
Emit a deprecation warning when a variadic parameter in a
parameter-declaration-clause is not preceded by a comma for C++26.
|
Revision tags: llvmorg-19.1.4 |
|
#
834dfd23 |
| 18-Nov-2024 |
Kazu Hirata <kazu@google.com> |
[Parse] Remove ParseDiagnostic.h (#116496)
This patch removes clang/Parse/ParseDiagnostic.h because it just
forwards to clang/Basic/DiagnosticParse.h.
|
Revision tags: llvmorg-19.1.3 |
|
#
4dd55c56 |
| 24-Oct-2024 |
Jay Foad <jay.foad@amd.com> |
[clang] Use {} instead of std::nullopt to initialize empty ArrayRef (#109399)
Follow up to #109133.
|
Revision tags: llvmorg-19.1.2 |
|
#
679be527 |
| 02-Oct-2024 |
c8ef <c8ef@outlook.com> |
[Clang][NFC] Consolidate the parameter check for the `requires` expression parameter. (#110773)
This patch is a follow-up to #109831. In the discussion, we agreed that
having parameter checks scatt
[Clang][NFC] Consolidate the parameter check for the `requires` expression parameter. (#110773)
This patch is a follow-up to #109831. In the discussion, we agreed that
having parameter checks scattered across different areas isn't ideal.
Therefore, I suggest merging the check from #88974 into the void
parameter check. This change won't impact functionality and will enhance
maintainability.
show more ...
|
Revision tags: llvmorg-19.1.1 |
|
#
a9d9b0a0 |
| 18-Sep-2024 |
Mariya Podchishchaeva <mariya.podchishchaeva@intel.com> |
[clang][C23] Claim N3030 Enhancements to Enumerations supported (#107260)
Clang already implemented functionality as an extension.
|
Revision tags: llvmorg-19.1.0 |
|
#
06013703 |
| 11-Sep-2024 |
yronglin <yronglin777@gmail.com> |
Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#108039)
The PR reapply https://github.com/llvm/llvm-projec
Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#108039)
The PR reapply https://github.com/llvm/llvm-project/pull/97308.
- Implement [CWG1815](https://wg21.link/CWG1815): Support lifetime
extension of temporary created by aggregate initialization using a
default member initializer.
- Fix crash that introduced in
https://github.com/llvm/llvm-project/pull/97308. In
`InitListChecker::FillInEmptyInitForField`, when we enter
rebuild-default-init context, we copy all the contents of the parent
context to the current context, which will cause the `MaybeODRUseExprs`
to be lost. But we don't need to copy the entire context, only the
`DelayedDefaultInitializationContext` was required, which is used to
build `SourceLocExpr`, etc.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
show more ...
|
#
cca54e34 |
| 09-Sep-2024 |
Martin Storsjö <martin@martin.st> |
Revert "Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#97308)"
This reverts commit 45c8766973bb3bb73dd8d9
Revert "Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#97308)"
This reverts commit 45c8766973bb3bb73dd8d996231e114dcf45df9f and 049512e39d96995cb373a76cf2d009a86eaf3aab.
This change triggers failed asserts on inputs like this:
struct a { } constexpr b; class c { public: c(a); }; class B { public: using d = int; struct e { enum { f } g; int h; c i; d j{}; }; }; B::e k{B::e::f, int(), b};
Compiled like this:
clang -target x86_64-linux-gnu -c repro.cpp clang: ../../clang/lib/CodeGen/CGExpr.cpp:3105: clang::CodeGen::LValue clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr*): Assertion `(ND->isUsed(false) || !isa<VarDecl>(ND) || E->isNonOdrUse() || !E->getLocation().isValid()) && "Should not use decl without marking it used!"' failed.
show more ...
|
#
45c87669 |
| 08-Sep-2024 |
yronglin <yronglin777@gmail.com> |
Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#97308)
The PR reapply https://github.com/llvm/llvm-project
Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (#97308)
The PR reapply https://github.com/llvm/llvm-project/pull/92527.
Implemented CWG1815 and fixed the bugs mentioned in the comments of
https://github.com/llvm/llvm-project/pull/92527 and
https://github.com/llvm/llvm-project/pull/87933.
The reason why the original PR was reverted was that errors might occur
during the rebuild.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
show more ...
|
#
7815abec |
| 06-Sep-2024 |
Bill Wendling <morbo@google.com> |
[Parser][NFC] Move the core parsing of an attribute into a separate method (#107300)
Refactor attribute parsing so that the main code parsing an attribute
can be called by a separate code path that
[Parser][NFC] Move the core parsing of an attribute into a separate method (#107300)
Refactor attribute parsing so that the main code parsing an attribute
can be called by a separate code path that doesn't start with the
'__attribute' keyword.
show more ...
|
Revision tags: llvmorg-19.1.0-rc4 |
|
#
ebc4a66e |
| 23-Aug-2024 |
Joshua Batista <jbatista@microsoft.com> |
Implement resource binding type prefix mismatch diagnostic infrastructure (#97103)
There are currently no diagnostics being emitted for when a resource is
bound to a register with an incorrect bind
Implement resource binding type prefix mismatch diagnostic infrastructure (#97103)
There are currently no diagnostics being emitted for when a resource is
bound to a register with an incorrect binding type prefix. For example,
a CBuffer type resource should be bound with a a binding type prefix of
'b', but if instead the prefix is 'u', no errors will be emitted. This
PR implements such diagnostics. The focus of this PR is to implement
both the flag setting and diagnostic emisison steps specified in the
relevant spec: https://github.com/microsoft/hlsl-specs/pull/230
The relevant issue is: https://github.com/llvm/llvm-project/issues/57886
This is a continuation / refresh of this PR:
https://github.com/llvm/llvm-project/pull/87578
show more ...
|
#
281d1784 |
| 21-Aug-2024 |
Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> |
[clang] Diagnose functions with too many parameters (#104833)
This patch adds a parser check when a function declaration or function
type declaration (in a function pointer declaration, for example
[clang] Diagnose functions with too many parameters (#104833)
This patch adds a parser check when a function declaration or function
type declaration (in a function pointer declaration, for example) has
too many parameters for `FunctionTypeBits::NumParams` to hold. At the
moment of writing it's a 16-bit-wide bit-field, limiting the number of
parameters at 65536.
The check is added in the parser loop that goes over comma-separated
list of function parameters. This is not the solution Aaron suggested in
https://github.com/llvm/llvm-project/issues/35741#issuecomment-1638086571,
because it was found out that it's quite hard to recover from this
particular error in `GetFullTypeForDeclarator()`. Multiple options were
tried, but all of them led to crashes down the line.
I used LLVM Compile Time Tracker to ensure this does not introduce a
performance regression. I believe changes are in the noise:
https://llvm-compile-time-tracker.com/compare.php?from=de5ea2d122c31e1551654ff506c33df299f351b8&to=424818620766cedb2770e076ee359afeb0cc14ec&stat=instructions:u
Fixes #35741
show more ...
|
Revision tags: llvmorg-19.1.0-rc3 |
|
#
62503132 |
| 06-Aug-2024 |
Mike Rice <michael.p.rice@intel.com> |
[clang] Fix compile-time regression from attribute arg checking change (#101768)
In 2acf77f987331c05520c5bfd849326909ffce983 code was added to use the
'full' name including syntax and scope.
Ins
[clang] Fix compile-time regression from attribute arg checking change (#101768)
In 2acf77f987331c05520c5bfd849326909ffce983 code was added to use the
'full' name including syntax and scope.
Instead of building up a large string for each name, add syntax and
scope checks to the value expression in tablegen.
There is already code to generate expressions for target specific
attributes. This change refactors and adds to that code to include
syntax and scope checks.
The tablegen avoids generating the complicated expression unless there
are two attributes using the same name, otherwise the case values will
be as simple as before.
Removes the currently unused attributeHasStrictIdentifierArgAtIndex
function and the related tablegen.
show more ...
|
#
52956b0f |
| 05-Aug-2024 |
Helena Kotas <hekotas@microsoft.com> |
[HLSL] Implement intangible AST type (#97362)
HLSL has a set of intangible types which are described in in the
[draft HLSL Specification
(**[Basic.types]**)](https://microsoft.github.io/hlsl-specs
[HLSL] Implement intangible AST type (#97362)
HLSL has a set of intangible types which are described in in the
[draft HLSL Specification
(**[Basic.types]**)](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf):
There are special implementation-defined types such as handle types,
which fall into a category of standard intangible types. Intangible
types are types that have no defined object representation or value
representation, as such the size is unknown at compile time.
A class type T is an intangible class type if it contains an base
classes or members of intangible class type, standard intangible type,
or arrays of such types. Standard intangible types and intangible class
types are collectively called intangible
types([9](https://microsoft.github.io/hlsl-specs/specs/hlsl.html#Intangible)).
This PR implements one standard intangible type `__hlsl_resource_t`
and sets up the infrastructure that will make it easier to add more
in the future, such as samplers or raytracing payload handles. The
HLSL intangible types are declared in
`clang/include/clang/Basic/HLSLIntangibleTypes.def` and this file is
included with related macro definition in most places that require edits
when a new type is added.
The new types are added as keywords and not typedefs to make sure they
cannot be redeclared, and they can only be declared in builtin implicit
headers. The `__hlsl_resource_t` type represents a handle to a memory
resource and it is going to be used in builtin HLSL buffer types like this:
template <typename T>
class RWBuffer {
[[hlsl::contained_type(T)]]
[[hlsl::is_rov(false)]]
[[hlsl::resource_class(uav)]]
__hlsl_resource_t Handle;
};
Part 1/3 of llvm/llvm-project#90631.
---------
Co-authored-by: Justin Bogner <mail@justinbogner.com>
show more ...
|
Revision tags: llvmorg-19.1.0-rc2 |
|
#
2acf77f9 |
| 30-Jul-2024 |
Mike Rice <michael.p.rice@intel.com> |
[clang] Update argument checking tablegen code to use a 'full' name (#99993)
In 92fc1eb0c1ae3813f2ac9208e2c74207aae9d23 the HLSLLoopHint attribute
was added with an 'unroll' spelling. There is an e
[clang] Update argument checking tablegen code to use a 'full' name (#99993)
In 92fc1eb0c1ae3813f2ac9208e2c74207aae9d23 the HLSLLoopHint attribute
was added with an 'unroll' spelling. There is an existing LoopHint
attribute with the same spelling. These attributes have different
arguments.
The tablegen used to produce checks on arguments uses only the attribute
name, making it impossible to return correct info for attribute with
different argument types but the same name.
Improve the situation by using a 'full' name that combines the syntax,
scope, and name. This allows, for example, #pragma unroll and
[[unroll(x)]] to coexist correctly even with different argument types.
Also fix a bug in the StrictEnumParameters tablegen. If will now
correctly specify each parameter instead of only the first.
show more ...
|
#
708a9a06 |
| 29-Jul-2024 |
Krystian Stasiowski <sdkrystian@gmail.com> |
[Clang][Parse] Fix ambiguity with nested-name-specifiers that may declarative (#96364)
Consider the following:
```
template<typename T>
struct A { };
template<typename T>
int A<T>::B::* f();
[Clang][Parse] Fix ambiguity with nested-name-specifiers that may declarative (#96364)
Consider the following:
```
template<typename T>
struct A { };
template<typename T>
int A<T>::B::* f(); // error: no member named 'B' in 'A<T>'
```
Although this is clearly valid, clang rejects it because the
_nested-name-specifier_ `A<T>::` is parsed as-if it was declarative,
meaning, we parse it as-if it was the _nested-name-specifier_ in a
redeclaration/specialization. However, we don't (and can't) know whether
the _nested-name-specifier_ is declarative until we see the '`*`' token,
but at that point we have already complained that `A` has no member
named `B`! This patch addresses this bug by adding support for _fully_
unannotated _and_ unbounded tentative parsing, which allows for us to
parse past tokens without having to cache them until we reach a point
where we can guarantee to be past the construct we are disambiguating.
I don't know where the approach taken here is ideal -- alternatives are
welcome. However, the performance impact (as measured by
llvm-compile-time-tracker (https://llvm-compile-time-tracker.com/?config=Overview&stat=instructions%3Au&remote=sdkrystian)
is quite minimal (0.09%, which I plan to further improve).
show more ...
|
Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init |
|
#
c91e8527 |
| 22-Jul-2024 |
yronglin <yronglin777@gmail.com> |
Revert "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (#99838)
Reverts llvm/llvm-project#90574
|
#
e77a01d7 |
| 20-Jul-2024 |
yronglin <yronglin777@gmail.com> |
[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros (#90574)
This PR implement [P3034R1 Module Declarations Shouldn’t be
Macros](https://wg21.link/P3034R1), and refactor the convolute
[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros (#90574)
This PR implement [P3034R1 Module Declarations Shouldn’t be
Macros](https://wg21.link/P3034R1), and refactor the convoluted state
machines in module name lexical analysis.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
show more ...
|
#
e22ebee5 |
| 09-Jul-2024 |
Henrik G. Olsson <hnrklssn@gmail.com> |
[Bounds-Safety] Add sized_by, counted_by_or_null & sized_by_or_null (#93231)
The attributes `sized_by`, `counted_by_or_null` and `sized_by_or_null`
have been added as variants on `counted_by`, each
[Bounds-Safety] Add sized_by, counted_by_or_null & sized_by_or_null (#93231)
The attributes `sized_by`, `counted_by_or_null` and `sized_by_or_null`
have been added as variants on `counted_by`, each with slightly
different semantics. `sized_by` takes a byte size parameter instead of
an element count, allowing pointees with unknown size. The
`counted_by_or_null` and `sized_by_or_null` variants are equivalent to
their base variants, except the pointer can be null regardless of
count/size value. If the pointer is null the size is effectively 0.
rdar://125400354
show more ...
|
#
c8ba5562 |
| 09-Jul-2024 |
Pierre d'Herbemont <pdherbemont@apple.com> |
Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#95455)
This fixes #20777. This replaces #94216 which was reverted after being
merged.
Previ
Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#95455)
This fixes #20777. This replaces #94216 which was reverted after being
merged.
Previously the `guarded_by`, `pt_guarded_by`, `acquired_after`, and
`acquired_before` attributes were only supported inside C++ classes or
top level C/C++ declaration.
This patch allows these attributes to be added to struct members in C.
These attributes have also now support experimental late parsing. This
is off by default but can be enabled by passing
`-fexperimental-late-parse-attributes`. This is useful for referring to
a struct member after the annotated member. E.g.
```
struct Example {
int a_value_defined_before __attribute__ ((guarded_by(a_mutex)));
struct Mutex *a_mutex;
};
```
show more ...
|
#
1b8ab2f0 |
| 27-Jun-2024 |
Oliver Hunt <oliver@apple.com> |
[clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (#94056)
Virtual function pointer entries in v-tables are signed with address
discrimination in addition to de
[clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (#94056)
Virtual function pointer entries in v-tables are signed with address
discrimination in addition to declaration-based discrimination, where an
integer discriminator the string hash (see
`ptrauth_string_discriminator`) of the mangled name of the overridden
method. This notably provides diversity based on the full signature of
the overridden method, including the method name and parameter types.
This patch introduces ItaniumVTableContext logic to find the original
declaration of the overridden method.
On AArch64, these pointers are signed using the `IA` key (the
process-independent code key.)
V-table pointers can be signed with either no discrimination, or a
similar scheme using address and decl-based discrimination. In this
case, the integer discriminator is the string hash of the mangled
v-table identifier of the class that originally introduced the vtable
pointer.
On AArch64, these pointers are signed using the `DA` key (the
process-independent data key.)
Not using discrimination allows attackers to simply copy valid v-table
pointers from one object to another. However, using a uniform
discriminator of 0 does have positive performance and code-size
implications on AArch64, and diversity for the most important v-table
access pattern (virtual dispatch) is already better assured by the
signing schemas used on the virtual functions. It is also known that
some code in practice copies objects containing v-tables with `memcpy`,
and while this is not permitted formally, it is something that may be
invasive to eliminate.
This is controlled by:
```
-fptrauth-vtable-pointer-type-discrimination
-fptrauth-vtable-pointer-address-discrimination
```
In addition, this provides fine-grained controls in the
ptrauth_vtable_pointer attribute, which allows overriding the default
ptrauth schema for vtable pointers on a given class hierarchy, e.g.:
```
[[clang::ptrauth_vtable_pointer(no_authentication, no_address_discrimination,
no_extra_discrimination)]]
[[clang::ptrauth_vtable_pointer(default_key, default_address_discrimination,
custom_discrimination, 0xf00d)]]
```
The override is then mangled as a parametrized vendor extension:
```
"__vtptrauth" I
<key>
<addressDiscriminated>
<extraDiscriminator>
E
```
To support this attribute, this patch adds a small extension to the
attribute-emitter tablegen backend.
Note that there are known areas where signing is either missing
altogether or can be strengthened. Some will be addressed in later
changes (e.g., member function pointers, some RTTI).
`dynamic_cast` in particular is handled by emitting an artificial
v-table pointer load (in a way that always authenticates it) before the
runtime call itself, as the runtime doesn't have enough information
today to properly authenticate it. Instead, the runtime is currently
expected to strip the v-table pointer.
---------
Co-authored-by: John McCall <rjmccall@apple.com>
Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org>
show more ...
|
Revision tags: llvmorg-18.1.8 |
|
#
c9d58003 |
| 12-Jun-2024 |
Dan Liew <dan@su-root.co.uk> |
Revert "Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#94216)"
This reverts commit af0d7128c8fd053d3de8af208d7d1682bc7a525a.
Reverting due to
Revert "Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#94216)"
This reverts commit af0d7128c8fd053d3de8af208d7d1682bc7a525a.
Reverting due to likely regression:
https://github.com/llvm/llvm-project/pull/94216#issuecomment-2164013300
show more ...
|
#
af0d7128 |
| 12-Jun-2024 |
Pierre d'Herbemont <pdherbemont@gmail.com> |
Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#94216)
This fixes #20777.
Previously the `guarded_by`, `pt_guarded_by`, `acquired_after`, an
Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#94216)
This fixes #20777.
Previously the `guarded_by`, `pt_guarded_by`, `acquired_after`, and `acquired_before` attributes were only supported inside C++ classes or top level C/C++ declaration.
This patch allows these attributes to be added to struct members in C. These attributes have also now support experimental late parsing. This is off by default but can be enabled by passing `-fexperimental-late-parse-attributes`. This is useful for referring to a struct member after the annotated member. E.g.
```
struct Example {
int a_value_defined_before __attribute__ ((guarded_by(a_mutex)));
struct Mutex *a_mutex;
};
```
Patch by Pierre d'Herbemont (@pdherbemont)
show more ...
|