History log of /llvm-project/clang/lib/Serialization/ASTWriter.cpp (Results 1 – 25 of 1444)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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
# 0865ecc5 28-Jan-2025 Nikolas Klauser <nikolasklauser@berlin.de>

[clang] Extend diagnose_if to accept more detailed warning information, take 2 (#119712)

This is take two of #70976. This iteration of the patch makes sure that
custom
diagnostics without any warnin

[clang] Extend diagnose_if to accept more detailed warning information, take 2 (#119712)

This is take two of #70976. This iteration of the patch makes sure that
custom
diagnostics without any warning group don't get promoted by `-Werror` or
`-Wfatal-errors`.

This implements parts of the extension proposed in
https://discourse.llvm.org/t/exposing-the-diagnostic-engine-to-c/73092/7.

Specifically, this makes it possible to specify a diagnostic group in an
optional third argument.

show more ...


# f63e8ed1 22-Jan-2025 Ilya Biryukov <ibiryukov@google.com>

Revert "[Modules] Delay deserialization of preferred_name attribute at r… (#122726)"

This reverts commit c3ba6f378ef80d750e2278560c6f95a300114412.

We are seeing performance regressions of up to 40%

Revert "[Modules] Delay deserialization of preferred_name attribute at r… (#122726)"

This reverts commit c3ba6f378ef80d750e2278560c6f95a300114412.

We are seeing performance regressions of up to 40% on some compilations
with this patch, we will investigate and reland after fixing performance
issues.

show more ...


# 05861b39 22-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Make sure vtable are generated for explicit template instantiation definition (#123871)

Close https://github.com/llvm/llvm-project/issues/123719

The reason is, we thought the ex

[C++20] [Modules] Make sure vtable are generated for explicit template instantiation definition (#123871)

Close https://github.com/llvm/llvm-project/issues/123719

The reason is, we thought the external explicit template instantiation
declaration as the external definition incorrectly.

show more ...


# fb2c9d94 17-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Makes sure internal declaration won't be found by other TU (#123059)

Close https://github.com/llvm/llvm-project/issues/61427

And this is also helpful to implement
https://githu

[C++20] [Modules] Makes sure internal declaration won't be found by other TU (#123059)

Close https://github.com/llvm/llvm-project/issues/61427

And this is also helpful to implement
https://github.com/llvm/llvm-project/issues/112294 partially.

The implementation strategy mimics
https://github.com/llvm/llvm-project/pull/122887. This patch split the
internal declarations from the general lookup table so that other TU
can't find the internal declarations.

show more ...


# c3ba6f37 17-Jan-2025 Viktoriia Bakalova <115406782+VitaNuo@users.noreply.github.com>

[Modules] Delay deserialization of preferred_name attribute at r… (#122726)

…ecord level.

This fixes the incorrect diagnostic emitted when compiling the following
snippet

```
// string_view.

[Modules] Delay deserialization of preferred_name attribute at r… (#122726)

…ecord level.

This fixes the incorrect diagnostic emitted when compiling the following
snippet

```
// string_view.h
template<class _CharT>
class basic_string_view;

typedef basic_string_view<char> string_view;

template<class _CharT>
class
__attribute__((__preferred_name__(string_view)))
basic_string_view {
public:
basic_string_view()
{
}
};

inline basic_string_view<char> foo()
{
return basic_string_view<char>();
}
// A.cppm
module;
#include "string_view.h"
export module A;

// Use.cppm
module;
#include "string_view.h"
export module Use;
import A;
```

The diagnostic is
```
string_view.h:11:5: error: 'basic_string_view<char>::basic_string_view' from module 'A.<global>' is not present in definition of 'string_view' provided earlier
```

The underlying issue is that deserialization of the `preferred_name`
attribute triggers deserialization of `basic_string_view<char>`, which
triggers the deserialization of the `preferred_name` attribute again
(since it's attached to the `basic_string_view` template).
The deserialization logic is implemented in a way that prevents it from
going on a loop in a literal sense (it detects early on that it has
already seen the `string_view` typedef when trying to start its
deserialization for the second time), but leaves the typedef
deserialization in an unfinished state. Subsequently, the `string_view`
typedef from the deserialized module cannot be merged with the same
typedef from `string_view.h`, resulting in the above diagnostic.

This PR resolves the problem by delaying the deserialization of the
`preferred_name` attribute until the deserialization of the
`basic_string_view` template is completed. As a result of deferring, the
deserialization of the `preferred_name` attribute doesn't need to go on
a loop since the type of the `string_view` typedef is already known when
it's deserialized.

show more ...


# c5e4afe6 17-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Support module level lookup (#122887) (#123281)

Close https://github.com/llvm/llvm-project/issues/90154

This patch is also an optimization to the lookup process to utilize the

[C++20] [Modules] Support module level lookup (#122887) (#123281)

Close https://github.com/llvm/llvm-project/issues/90154

This patch is also an optimization to the lookup process to utilize the
information provided by `export` keyword.

Previously, in the lookup process, the `export` keyword only takes part
in the check part, it doesn't get involved in the lookup process. That
said, previously, in a name lookup for 'name', we would load all of
declarations with the name 'name' and check if these declarations are
valid or not. It works well. But it is inefficient since it may load
declarations that may not be wanted.

Note that this patch actually did a trick in the lookup process instead
of bring module information to DeclarationName or considering module
information when deciding if two declarations are the same. So it may
not be a surprise to me if there are missing cases. But it is not a
regression. It should be already the case. Issue reports are welcomed.

In this patch, I tried to split the big lookup table into a lookup table
as before and a module local lookup table, which takes a combination of
the ID of the DeclContext and hash value of the primary module name as
the key. And refactored `DeclContext::lookup()` method to take the
module information. So that a lookup in a DeclContext won't load
declarations that are local to **other** modules.

And also I think it is already beneficial to split the big lookup table
since it may reduce the conflicts during lookups in the hash table.

BTW, this patch introduced a **regression** for a reachability rule in
C++20 but it was false-negative. See
'clang/test/CXX/module/module.interface/p7.cpp' for details.

This patch is not expected to introduce any other
regressions for non-c++20-modules users since the module local lookup
table should be empty for them.

show more ...


# 731db2a0 16-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

Revert "[C++20] [Modules] Support module level lookup (#122887)"

This reverts commit 7201cae106260aeb3e9bbbb7d5291ff30f05076a.


# 18650480 15-Jan-2025 Steven Wu <stevenwu@apple.com>

[clang][Serialization] Add the missing block info (#122976)

HEADER_SEARCH_ENTRY_USAGE and VFS_USAGE were missing from the block info
block. Add the missing info so `llvm-bcanalyzer` can read them

[clang][Serialization] Add the missing block info (#122976)

HEADER_SEARCH_ENTRY_USAGE and VFS_USAGE were missing from the block info
block. Add the missing info so `llvm-bcanalyzer` can read them
correctly.

show more ...


# 7201cae1 15-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Support module level lookup (#122887)

Close https://github.com/llvm/llvm-project/issues/90154

This patch is also an optimization to the lookup process to utilize the
informatio

[C++20] [Modules] Support module level lookup (#122887)

Close https://github.com/llvm/llvm-project/issues/90154

This patch is also an optimization to the lookup process to utilize the
information provided by `export` keyword.

Previously, in the lookup process, the `export` keyword only takes part
in the check part, it doesn't get involved in the lookup process. That
said, previously, in a name lookup for 'name', we would load all of
declarations with the name 'name' and check if these declarations are
valid or not. It works well. But it is inefficient since it may load
declarations that may not be wanted.

Note that this patch actually did a trick in the lookup process instead
of bring module information to DeclarationName or considering module
information when deciding if two declarations are the same. So it may
not be a surprise to me if there are missing cases. But it is not a
regression. It should be already the case. Issue reports are welcomed.

In this patch, I tried to split the big lookup table into a lookup table
as before and a module local lookup table, which takes a combination of
the ID of the DeclContext and hash value of the primary module name as
the key. And refactored `DeclContext::lookup()` method to take the
module information. So that a lookup in a DeclContext won't load
declarations that are local to **other** modules.

And also I think it is already beneficial to split the big lookup table
since it may reduce the conflicts during lookups in the hash table.

BTW, this patch introduced a **regression** for a reachability rule in
C++20 but it was false-negative. See
'clang/test/CXX/module/module.interface/p7.cpp' for details.

This patch is not expected to introduce any other
regressions for non-c++20-modules users since the module local lookup
table should be empty for them.

---

On the API side, this patch unfortunately add a maybe-confusing argument
`Module *NamedModule` to
`ExternalASTSource::FindExternalVisibleDeclsByName()`. People may think
we can get the information from the first argument `const DeclContext
*DC`. But sadly there are declarations (e.g., namespace) can appear in
multiple different modules as a single declaration. So we have to add
additional information to indicate this.

show more ...


Revision tags: llvmorg-19.1.7
# ad38e24e 13-Jan-2025 David Pagan <dave.pagan@amd.com>

[clang][OpenMP] Add 'align' modifier for 'allocate' clause (#121814)

The 'align' modifier is now accepted in the 'allocate' clause. Added LIT
tests covering codegen, PCH, template handling, and seri

[clang][OpenMP] Add 'align' modifier for 'allocate' clause (#121814)

The 'align' modifier is now accepted in the 'allocate' clause. Added LIT
tests covering codegen, PCH, template handling, and serialization for
'align' modifier.

Added support for align-modifier to release notes.

Testing
- New allocate modifier LIT tests.
- OpenMP LIT tests.
- check-all

show more ...


# be32621c 09-Jan-2025 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'device' and 'host' clauses for 'update'

These two clauses just take a 'var-list' and specify where the variables
should be copied from/to. This patch implements the AST nodes f

[OpenACC] Implement 'device' and 'host' clauses for 'update'

These two clauses just take a 'var-list' and specify where the variables
should be copied from/to. This patch implements the AST nodes for them
and ensures they properly take a var-list.

show more ...


# 2c2accbc 08-Jan-2025 erichkeane <ekeane@nvidia.com>

[OpenACC] Enable 'self' sema for 'update' construct

The 'self' clause is an unfortunately difficult one, as it has a
significantly different meaning between 'update' and the other
constructs. This

[OpenACC] Enable 'self' sema for 'update' construct

The 'self' clause is an unfortunately difficult one, as it has a
significantly different meaning between 'update' and the other
constructs. This patch introduces a way for the 'self' clause to work
as both. I considered making this two separate AST nodes (one for
'self' on 'update' and one for the others), however this makes the
automated macros/etc for supporting a clause break.

Instead, 'self' has the ability to act as either a condition or as a
var-list clause. As this is the only one of its kind, it is implemented
all within it. If in the future we have more that work like this, we
should consider rewriting a lot of the macros that we use to make
clauses work, and make them separate ast nodes.

show more ...


# ff24e9a1 06-Jan-2025 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'default_async' sema

A fairly simple one, only valid on the 'set' construct, this clause
takes an int expression. Most of the work was already done as a part of
parsing, so this

[OpenACC] Implement 'default_async' sema

A fairly simple one, only valid on the 'set' construct, this clause
takes an int expression. Most of the work was already done as a part of
parsing, so this patch ends up being a lot of infrastructure.

show more ...


# a13bcf3c 06-Jan-2025 Alejandro Álvarez Ayllón <alejandro.alvarez@sonarsource.com>

[clang] Do not serialize function definitions without a body (#121550)

An instantiated templated function definition may not have a body due to
parsing errors inside the templated function. When se

[clang] Do not serialize function definitions without a body (#121550)

An instantiated templated function definition may not have a body due to
parsing errors inside the templated function. When serializing, an
assert is triggered inside `ASTRecordWriter::AddFunctionDefinition`.

The instantiation may happen on an intermediate module.

The test case was reduced from `mp-units`.

show more ...


# bdf25553 19-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'device_num' clause sema for 'init'/'shutdown'

This is a very simple sema implementation, and just required AST node
plus the existing diagnostics. This patch adds tests and add

[OpenACC] Implement 'device_num' clause sema for 'init'/'shutdown'

This is a very simple sema implementation, and just required AST node
plus the existing diagnostics. This patch adds tests and adds the AST
node required, plus enables it for 'init' and 'shutdown' (only!)

show more ...


Revision tags: llvmorg-19.1.6
# fbb14dd9 16-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'use_device' clause AST/Sema

This is a clause that is only valid on 'host_data' constructs, and
identifies variables which it should use the current device address.
From a Sema p

[OpenACC] Implement 'use_device' clause AST/Sema

This is a clause that is only valid on 'host_data' constructs, and
identifies variables which it should use the current device address.
From a Sema perspective, the only thing novel here is mild changes to
how ActOnVar works for this clause, else this is very much like the rest
of the 'var-list' clauses.

show more ...


# 1ab81f8e 16-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'delete' AST/Sema for 'exit data' construct

'delete' is another clause that has very little compile-time
implication, but needs a full AST that takes a var list. This patch
ipml

[OpenACC] Implement 'delete' AST/Sema for 'exit data' construct

'delete' is another clause that has very little compile-time
implication, but needs a full AST that takes a var list. This patch
ipmlements it fully, plus adds sufficient test coverage.

show more ...


# 38b3d87b 16-Dec-2024 Dmitry Polukhin <34227995+dmpolukhin@users.noreply.github.com>

[C++20][Modules] Load function body from the module that gives canonical decl (#111992)

Summary:
Fix crash from reproducer provided in
https://github.com/llvm/llvm-project/pull/109167#issuecomment

[C++20][Modules] Load function body from the module that gives canonical decl (#111992)

Summary:
Fix crash from reproducer provided in
https://github.com/llvm/llvm-project/pull/109167#issuecomment-2405289565
Also fix issues with merged inline friend functions merged during deserialization.

Test Plan: check-clang

show more ...


# 3351b3bf 13-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] implement 'detach' clause sema

This is another new clause specific to 'exit data' that takes a pointer
argument. This patch implements this the same way we do a few other
clauses (like att

[OpenACC] implement 'detach' clause sema

This is another new clause specific to 'exit data' that takes a pointer
argument. This patch implements this the same way we do a few other
clauses (like attach) that have the same restrictions.

show more ...


# 2244d2e7 13-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'if_present' clause sema

The 'if_present' clause controls the replacement of addresses in the
var-list in current device memory. This clause can only go on
'host_device'. From

[OpenACC] Implement 'if_present' clause sema

The 'if_present' clause controls the replacement of addresses in the
var-list in current device memory. This clause can only go on
'host_device'. From a Sema perspective, there isn't anything to do
beyond add this to AST and pass it on.

show more ...


# 003eb5e8 13-Dec-2024 erichkeane <ekeane@nvidia.com>

[OpenACC] Implement 'finalize' clause sema

This is a very simple clause as far as sema is concerned. It is only
valid on 'exit data', and doesn't have any rules involving it, so it is
simply applie

[OpenACC] Implement 'finalize' clause sema

This is a very simple clause as far as sema is concerned. It is only
valid on 'exit data', and doesn't have any rules involving it, so it is
simply applied and passed onto the MLIR.

show more ...


# 30ea0f0c 11-Dec-2024 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[NFC] [clang] [Serialization] Fix warning for narrowing cast


# 20e90495 11-Dec-2024 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[Serialization] Support loading template specializations lazily (#119333)

Reland https://github.com/llvm/llvm-project/pull/83237

---

(Original comments)

Currently all the specializations of

[Serialization] Support loading template specializations lazily (#119333)

Reland https://github.com/llvm/llvm-project/pull/83237

---

(Original comments)

Currently all the specializations of a template (including
instantiation, specialization and partial specializations) will be
loaded at once if we want to instantiate another instance for the
template, or find instantiation for the template, or just want to
complete the redecl chain.

This means basically we need to load every specializations for the
template once the template declaration got loaded. This is bad since
when we load a specialization, we need to load all of its template
arguments. Then we have to deserialize a lot of unnecessary
declarations.

For example,

```
// M.cppm
export module M;
export template <class T>
class A {};

export class ShouldNotBeLoaded {};

export class Temp {
A<ShouldNotBeLoaded> AS;
};

// use.cpp
import M;
A<int> a;
```

We have a specialization ` A<ShouldNotBeLoaded>` in `M.cppm` and we
instantiate the template `A` in `use.cpp`. Then we will deserialize
`ShouldNotBeLoaded` surprisingly when compiling `use.cpp`. And this
patch tries to avoid that.

Given that the templates are heavily used in C++, this is a pain point
for the performance.

This patch adds MultiOnDiskHashTable for specializations in the
ASTReader. Then we will only deserialize the specializations with the
same template arguments. We made that by using ODRHash for the template
arguments as the key of the hash table.

To review this patch, I think `ASTReaderDecl::AddLazySpecializations`
may be a good entry point.

show more ...


# 83cb3dbc 09-Dec-2024 Kazu Hirata <kazu@google.com>

[Serialization] Migrate away from PointerUnion::{is,get} (NFC) (#118948)

Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

// FIXME: Replace the uses of is(), get()

[Serialization] Migrate away from PointerUnion::{is,get} (NFC) (#118948)

Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>

I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.

show more ...


12345678910>>...58