History log of /llvm-project/clang/lib/AST/TypePrinter.cpp (Results 1 – 25 of 373)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# d92bac8a 25-Jan-2025 Helena Kotas <hekotas@microsoft.com>

[HLSL] Introduce address space `hlsl_constant(2)` for constant buffer declarations (#123411)

Introduces a new address space `hlsl_constant(2)` for constant buffer
declarations.

This address spac

[HLSL] Introduce address space `hlsl_constant(2)` for constant buffer declarations (#123411)

Introduces a new address space `hlsl_constant(2)` for constant buffer
declarations.

This address space is applied to declarations inside `cbuffer` block.
Later on, it will also be applied to `ConstantBuffer<T>` syntax and the
default `$Globals` constant buffer.

Clang codegen translates constant buffer declarations to global
variables and loads from `hlsl_constant(2)` address space. More work
coming soon will include addition of metadata that will map these
globals to individual constant buffers and enable their transformation
to appropriate constant buffer load intrinsics later on in an LLVM pass.

Fixes #123406

show more ...


Revision tags: llvmorg-19.1.7
# 08028d68 12-Jan-2025 Sander de Smalen <sander.desmalen@arm.com>

[Clang] Fix buildbot failure introduced by #121788

Silences 'enumeration not handled in switch' warning,
which causes buildbot failures with -Werror.


# b4ce29ab 12-Jan-2025 Sander de Smalen <sander.desmalen@arm.com>

[AArch64][Clang] Add support for __arm_agnostic("sme_za_state") (#121788)

This adds support for parsing the attribute and codegen to map it to
"aarch64_za_state_agnostic" LLVM IR attribute.

This

[AArch64][Clang] Add support for __arm_agnostic("sme_za_state") (#121788)

This adds support for parsing the attribute and codegen to map it to
"aarch64_za_state_agnostic" LLVM IR attribute.

This attribute is described in the Arm C Language Extensions (ACLE)
document:

https://github.com/ARM-software/acle/blob/main/main/acle.md#__arm_agnostic

show more ...


Revision tags: llvmorg-19.1.6, llvmorg-19.1.5
# f8b4182f 02-Dec-2024 Nathan Gauër <brioche@google.com>

Revert "[SPIR-V] Fixup storage class for global private (#116636)" (#118312)

This reverts commit aa7fe1c10e5d6d0d3aacdb345fed995de413e142.


# aa7fe1c1 02-Dec-2024 Nathan Gauër <brioche@google.com>

[SPIR-V] Fixup storage class for global private (#116636)

Adds a new address spaces: `hlsl_private`. Variables with such address
space will be emitted with a `Private` storage class.
This is usefu

[SPIR-V] Fixup storage class for global private (#116636)

Adds a new address spaces: `hlsl_private`. Variables with such address
space will be emitted with a `Private` storage class.
This is useful for variables global to a SPIR-V module, since up to now,
they were still emitted with a `Function` storage class, which is wrong.

---------

Signed-off-by: Nathan Gauër <brioche@google.com>

show more ...


Revision tags: llvmorg-19.1.4
# dec6324c 17-Nov-2024 Kazu Hirata <kazu@google.com>

[AST] Remove unused includes (NFC) (#116549)

Identified with misc-include-cleaner.


# 3e20bae8 13-Nov-2024 Utkarsh Saxena <usx@google.com>

Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (#115823)

Fix compile time regression and memory leak

In the previous change, we saw:
- Memory leak: https://lab.llvm.org/buildbot/#/

Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (#115823)

Fix compile time regression and memory leak

In the previous change, we saw:
- Memory leak: https://lab.llvm.org/buildbot/#/builders/169/builds/5193
- 0.5% Compile time regression
[link](https://llvm-compile-time-tracker.com/compare.php?from=4a68e4cbd2423dcacada8162ab7c4bb8d7f7e2cf&to=8c4331c1abeb33eabf3cdbefa7f2b6e0540e7f4f&stat=instructions:u)

For compile time regression, we make the Param->Idx `StringMap` for
**all** functions. This `StringMap` is expensive and should not be
computed when none of the params are annotated with
`[[clang::lifetime_capture_by(X)]]`.

For the memory leak, the small vectors used in Attribute are not
destroyed because the attributes are allocated through ASTContext's
allocator. We therefore need a raw array in this case.

show more ...


# 3a03513f 11-Nov-2024 Nikita Popov <nikita.ppv@gmail.com>

Revert "[clang] Introduce [[clang::lifetime_capture_by(X)]] (#111499)"

This reverts commit 8c4331c1abeb33eabf3cdbefa7f2b6e0540e7f4f.

Causes a large compile-time regression, see:
https://llvm-compil

Revert "[clang] Introduce [[clang::lifetime_capture_by(X)]] (#111499)"

This reverts commit 8c4331c1abeb33eabf3cdbefa7f2b6e0540e7f4f.

Causes a large compile-time regression, see:
https://llvm-compile-time-tracker.com/compare.php?from=4a68e4cbd2423dcacada8162ab7c4bb8d7f7e2cf&to=8c4331c1abeb33eabf3cdbefa7f2b6e0540e7f4f&stat=instructions:u

show more ...


# 8c4331c1 11-Nov-2024 Utkarsh Saxena <usx@google.com>

[clang] Introduce [[clang::lifetime_capture_by(X)]] (#111499)

This implements the RFC
https://discourse.llvm.org/t/rfc-introduce-clang-lifetime-capture-by-x/81371

In this PR, we introduce `[[cla

[clang] Introduce [[clang::lifetime_capture_by(X)]] (#111499)

This implements the RFC
https://discourse.llvm.org/t/rfc-introduce-clang-lifetime-capture-by-x/81371

In this PR, we introduce `[[clang::lifetime_capture_by(X)]]` attribute
as discussed in the RFC.

As an implementation detail of this attribute, we store and use param
indices instead of raw param expressions. The parameter indices are
computed lazily at the end of function declaration since the function
decl (and therefore the subsequent parameters) are not visible yet while
parsing a parameter annotation.

In subsequent PR, we will infer this attribute for STL containers and
perform lifetime analysis to detect dangling cases.

show more ...


# d3daa3c4 31-Oct-2024 Pavel Yaskevich <xedin@apache.org>

[clang/AST] Make it possible to use SwiftAttr in type context (#108631)

Swift ClangImporter now supports concurrency annotations on imported
declarations and their parameters/results, to make it po

[clang/AST] Make it possible to use SwiftAttr in type context (#108631)

Swift ClangImporter now supports concurrency annotations on imported
declarations and their parameters/results, to make it possible to use
imported APIs in Swift safely there has to be a way to annotate
individual parameters and result types with relevant attributes that
indicate that e.g. a block is called on a particular actor or it accepts
a `Sendable` parameter.

To faciliate that `SwiftAttr` is switched from `InheritableAttr` which
is a declaration attribute to `DeclOrTypeAttr`. To support this
attribute in type context we need access to its "Attribute" argument
which requires `AttributedType` to be extended to include `Attr *` when
available instead of just `attr::Kind` otherwise it won't be possible to
determine what attribute should be imported.

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2
# bd12729a 11-Oct-2024 Alejandro Álvarez Ayllón <alejandro.alvarez@sonarsource.com>

[clang] Ignore inline namespace for `hasName` (#109147)

Add a new enumeration `SuppressInlineNamespaceMode` to `PrintingPolicy` that
is explicit about how to handle inline namespaces. `SuppressInli

[clang] Ignore inline namespace for `hasName` (#109147)

Add a new enumeration `SuppressInlineNamespaceMode` to `PrintingPolicy` that
is explicit about how to handle inline namespaces. `SuppressInlineNamespace`
uses that enumeration now instead of a Boolean value.

Specializing a template from an inline namespace should be transparent.
For instance

```
namespace foo {
inline namespace v1 {
template<typename A>
void function(A&);
}
}

namespace foo {
template<>
void function<int>(int&);
}
```

`hasName` should match both declarations of `foo::function`.

Makes the behavior of `matchesNodeFullSlow` and `matchesNodeFullFast`
consistent, fixing an assert inside `HasNameMatcher::matchesNode`.

show more ...


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0
# 5df1b793 17-Sep-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Add `[[hlsl::raw_buffer]]` attribute (#107954)

This PR introduces new HLSL resource type attribute
`[[hlsl::raw_buffer]]`. Presence of this attribute on a resource handle
means that the res

[HLSL] Add `[[hlsl::raw_buffer]]` attribute (#107954)

This PR introduces new HLSL resource type attribute
`[[hlsl::raw_buffer]]`. Presence of this attribute on a resource handle
means that the resource does not require typed element access. The
attribute will be used on resource handles that represent buffers like
`StructuredBuffer` or `ByteAddressBuffer` and in DXIL it will be
translated to target extension type `dx.RawBuffer`.

Fixes #107907

show more ...


# 0a7a1ef2 16-Sep-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Add `[[hlsl::contained_type()]]` attribute (#108456)

Introducing a new HLSL resource type attribute `[[contained_type(T)]]`
which describes the "contained type" of a buffer or resource type.

[HLSL] Add `[[hlsl::contained_type()]]` attribute (#108456)

Introducing a new HLSL resource type attribute `[[contained_type(T)]]`
which describes the "contained type" of a buffer or resource type.
Specifically, the attribute will be used on the resource handle in
templated buffer types like so:

template <typename T> struct RWBuffer {
__hlsl_resource_t [[hlsl::contained_type(T)]] [[hlsl::resource_class(UAV)]] h;
};

Fixes #104855

show more ...


# 61372fc5 10-Sep-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Warn on duplicate is_rov attribute; remove unnecessary parentheses (#107973)

We should issue a warning whenever a duplicate resource type attribute
is found. Currently we do that only for `r

[HLSL] Warn on duplicate is_rov attribute; remove unnecessary parentheses (#107973)

We should issue a warning whenever a duplicate resource type attribute
is found. Currently we do that only for `resource_class`. This PR fixes
that by checking for duplicate `is_rov` attributes as well.

Also removes unnecessary parenthesis on `is_rov`.

show more ...


# fa658047 07-Sep-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] Implement CWG2398 provisional TTP matching to class templates (#94981)

This extends default argument deduction to cover class templates as
well, applying only to partial ordering, adding to

[clang] Implement CWG2398 provisional TTP matching to class templates (#94981)

This extends default argument deduction to cover class templates as
well, applying only to partial ordering, adding to the provisional
wording introduced in https://github.com/llvm/llvm-project/pull/89807.

This solves some ambuguity introduced in P0522 regarding how template
template parameters are partially ordered, and should reduce the
negative impact of enabling `-frelaxed-template-template-args` by
default.

Given the following example:
```C++
template <class T1, class T2 = float> struct A;
template <class T3> struct B;

template <template <class T4> class TT1, class T5> struct B<TT1<T5>>; // #1
template <class T6, class T7> struct B<A<T6, T7>>; // #2

template struct B<A<int>>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous. This
patch restores the pre-P0522 behavior, `#2` is picked again.

show more ...


# 8e35c869 06-Sep-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Apply resource attributes to the resource type rather than the handle member (#107160)

Converts existing resource attributes `[[hlsl::resource_class(..)]]` and
`[[is_rov]]` from declaration

[HLSL] Apply resource attributes to the resource type rather than the handle member (#107160)

Converts existing resource attributes `[[hlsl::resource_class(..)]]` and
`[[is_rov]]` from declaration attributes to type attributes.

During type attribute processing all HLSL resource type attributes are
validated and collected by `SemaHLSL`
(`SemaHLSL::handleResourceTypeAttr`). At the end of the declaration they
are be combined into a single `HLSLAttributedResourceType` instance
(`SemaHLSL::ProcessResourceTypeAttributes`) that wraps the original type
and stores all of the necessary information about the resource.

`SemaHLSL` will also need to short-term-store the `TypeLoc` information
for the newly created type that will be grabbed by `TypeSpecLocFiller`
soon after it is created.

Updates all places that expected resource attributes on declarations
like resource binding diagnostic, builtin types in
HLSLExternalSemaSource, or codegen.

Also includes implementation of
`TreeTransform<Derived>::TransformHLSLAttributedResourceType` that
enables the use of attributed resource types inside templates.

Fixes #104861
Part 2/2

show more ...


Revision tags: llvmorg-19.1.0-rc4
# 89fb8490 31-Aug-2024 Chris B <chris.bieneman@me.com>

[HLSL] Implement output parameter (#101083)

HLSL output parameters are denoted with the `inout` and `out` keywords
in the function declaration. When an argument to an output parameter is
construct

[HLSL] Implement output parameter (#101083)

HLSL output parameters are denoted with the `inout` and `out` keywords
in the function declaration. When an argument to an output parameter is
constructed a temporary value is constructed for the argument.

For `inout` pamameters the argument is initialized via copy-initialization
from the argument lvalue expression to the parameter type. For `out`
parameters the argument is not initialized before the call.

In both cases on return of the function the temporary value is written
back to the argument lvalue expression through an implicit assignment
binary operator with casting as required.

This change introduces a new HLSLOutArgExpr ast node which represents
the output argument behavior. The OutArgExpr has three defined children:
- An OpaqueValueExpr of the argument lvalue expression.
- An OpaqueValueExpr of the copy-initialized parameter.
- A BinaryOpExpr assigning the first with the value of the second.

Fixes #87526

---------

Co-authored-by: Damyan Pepper <damyanp@microsoft.com>
Co-authored-by: John McCall <rjmccall@gmail.com>

show more ...


# e00e9a3f 30-Aug-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Add HLSLAttributedResourceType (#106181)

Introducing `HLSLAttributedResourceType` - a new type that is similar to
`AttributedType` but with additional data specific to HLSL resources.
`Attr

[HLSL] Add HLSLAttributedResourceType (#106181)

Introducing `HLSLAttributedResourceType` - a new type that is similar to
`AttributedType` but with additional data specific to HLSL resources.
`AttributeType` currently only stores an attribute kind and no
additional data from the type attribute parameters. This does not really
work for HLSL resources since its type attributes contain non-boolean
values that need to be retained as well.

For example:

```
template <typename T> class RWBuffer {
__hlsl_resource_t [[hlsl::resource_class(uav)]] [[hlsl::is_rov]] handle;
};
```

The data `HLSLAttributedResourceType` needs to eventually store are:
- resource class (SRV, UAV, CBuffer, Sampler)
- texture dimension(1-3)
- flags is_rov, is_array, is_feedback and is_multisample
- contained type

All of these values except contained type will be stored in
`HLSLAttributedResourceType::Attributes` struct and accessed
individually via the fields. There is also `Data` alias that covers all
of these values as a `unsigned` which is used for hashing and the AST
type serialization.

During type attribute processing all HLSL type attributes will be
validated and collected by SemaHLSL (by
`SemaHLSL::handleResourceTypeAttr`) and in the end combined into a
single `HLSLAttributedResourceType` instance (in
`SemaHLSL::ProcessResourceTypeAttributes`). `SemaHLSL` will also need to
short-term store the `TypeLoc` information for the new type that will be
grabbed by `TypeSpecLocFiller` soon after the type is created.

Part 1/2 of #104861

show more ...


Revision tags: llvmorg-19.1.0-rc3
# 635d20e9 08-Aug-2024 Vladislav Belov <vladislav.belov@syntacore.com>

[RISCV] full support for riscv_rvv_vector_bits attribute (#100110)

Add support for using attribute((rvv_vector_bits(N))), when N < 8.
It allows using all fixed length vector mask types regardless V

[RISCV] full support for riscv_rvv_vector_bits attribute (#100110)

Add support for using attribute((rvv_vector_bits(N))), when N < 8.
It allows using all fixed length vector mask types regardless VLEN
value.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 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 ...


# f03cb005 24-Jun-2024 Doug Wyatt <doug@sonosphere.com>

[Clang] Introduce `nonblocking`/`nonallocating` attributes (#84983)

Introduce `nonblocking` and `nonallocating` attributes. RFC is here:
https://discourse.llvm.org/t/rfc-nolock-and-noalloc-attribut

[Clang] Introduce `nonblocking`/`nonallocating` attributes (#84983)

Introduce `nonblocking` and `nonallocating` attributes. RFC is here:
https://discourse.llvm.org/t/rfc-nolock-and-noalloc-attributes/76837

This PR introduces the attributes, with some changes in Sema to deal
with them as extensions to function (proto)types.

There are some basic type checks, most importantly, a warning when
trying to spoof the attribute (implicitly convert a function without the
attribute to one that has it).

A second, follow-on pull request will introduce new caller/callee
verification.
---------
Co-authored-by: Doug Wyatt <dwyatt@apple.com>
Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Sirraide <aeternalmail@gmail.com>

show more ...


Revision tags: llvmorg-18.1.8
# b6fd6d4c 14-Jun-2024 Chris B <chris.bieneman@me.com>

[HLSL] Use hlsl vector template in type printer (#95489)

In HLSL we really want to be using the HLSL vector template and other
built-in sugared spellings for some builtin types. This updates the ty

[HLSL] Use hlsl vector template in type printer (#95489)

In HLSL we really want to be using the HLSL vector template and other
built-in sugared spellings for some builtin types. This updates the type
printer to take an option to use HLSL type spellings.

This changes printing vector type names from:

```
T __attribute__((ext_vector_type(N)))
```
To:
```
vector<T, N>
```

show more ...


Revision tags: llvmorg-18.1.7
# 9c4a716c 29-May-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] Preserve Qualifiers and type sugar in TemplateNames (#93433)

This patch improves the preservation of qualifiers and loss of type
sugar in TemplateNames.

This problem is analogous to https:/

[clang] Preserve Qualifiers and type sugar in TemplateNames (#93433)

This patch improves the preservation of qualifiers and loss of type
sugar in TemplateNames.

This problem is analogous to https://reviews.llvm.org/D112374 and this
patch takes a very similar approach to that patch, except the impact
here is much lesser.

When a TemplateName was written bare, without qualifications, we
wouldn't produce a QualifiedTemplate which could be used to disambiguate
it from a Canonical TemplateName. This had effects in the TemplateName
printer, which had workarounds to deal with this, and wouldn't print the
TemplateName as-written in most situations.

There are also some related fixes to help preserve this type sugar along
the way into diagnostics, so that this patch can be properly tested.

- Fix dropping the template keyword.
- Fix type deduction to preserve sugar in TST TemplateNames.

show more ...


# 2bde13cd 22-May-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] NFCI: use TemplateArgumentLoc for NTTP DefaultArgument (#92852)

This is an enabler for https://github.com/llvm/llvm-project/pull/92855

This allows an NTTP default argument to be set as an a

[clang] NFCI: use TemplateArgumentLoc for NTTP DefaultArgument (#92852)

This is an enabler for https://github.com/llvm/llvm-project/pull/92855

This allows an NTTP default argument to be set as an arbitrary
TemplateArgument, not just an expression.
This allows template parameter packs to have default arguments in the
AST, even though the language proper doesn't support the syntax for it.

This allows NTTP default arguments to be other kinds of arguments, like
packs, integral constants, and such.

show more ...


# e42b799b 21-May-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] NFCI: use TemplateArgumentLoc for type-param DefaultArgument (#92854)

This is an enabler for a future patch.

This allows an type-parameter default argument to be set as an arbitrary
Temp

[clang] NFCI: use TemplateArgumentLoc for type-param DefaultArgument (#92854)

This is an enabler for a future patch.

This allows an type-parameter default argument to be set as an arbitrary
TemplateArgument, not just a type.
This allows template parameter packs to have default arguments in the
AST, even though the language proper doesn't support the syntax for it.

This will be used in a later patch which synthesizes template parameter
lists with arbitrary default arguments taken from template
specializations.

There are a few places we used SubsType, because we only had a type, now
we use SubstTemplateArgument.
SubstTemplateArgument was missing arguments for setting Instantiation
location and entity names.
Adding those is needed so we don't regress in diagnostics.

show more ...


12345678910>>...15