History log of /llvm-project/clang/lib/Sema/SemaOverload.cpp (Results 1 – 25 of 1668)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# e29c0858 28-Jan-2025 Matheus Izvekov <mizvekov@gmail.com>

[clang] disallow narrowing when matching template template parameters (#124313)

This fixes the core issue described in P3579, following the design
intent of P0522 to not introduce any new cases whe

[clang] disallow narrowing when matching template template parameters (#124313)

This fixes the core issue described in P3579, following the design
intent of P0522 to not introduce any new cases where a template template
parameter match is allowed for a template which is not valid for all
possible uses.

With this patch, narrowing conversions are disallowed for TTP matching.

This reuses the existing machinery for diagnosing narrowing in a
converted constant expression.
Since P0522 is a DR and we apply it all the way back to C++98, this
brings that machinery to use in older standards, in this very narrow
scope of TTP matching.

This still doesn't solve the ambiguity when partial ordering NTTPs of
different integral types, this is blocked by a different bug which will
be fixed in a subsequent patch (but the test cases are added).

show more ...


# 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 ...


# 28ad8978 23-Jan-2025 Matheus Izvekov <mizvekov@gmail.com>

Reland: [clang] unified CWG2398 and P0522 changes; finishes implementation of P3310 (#124137)

This patch relands the following PRs:
* #111711
* #107350
* #111457

All of these patches were reve

Reland: [clang] unified CWG2398 and P0522 changes; finishes implementation of P3310 (#124137)

This patch relands the following PRs:
* #111711
* #107350
* #111457

All of these patches were reverted due to an issue reported in
https://github.com/llvm/llvm-project/pull/111711#issuecomment-2406491485,
due to interdependencies.

---
[clang] Finish implementation of P0522

This finishes the clang implementation of P0522, getting rid
of the fallback to the old, pre-P0522 rules.

Before this patch, when partial ordering template template parameters,
we would perform, in order:
* If the old rules would match, we would accept it. Otherwise, don't
generate diagnostics yet.
* If the new rules would match, just accept it. Otherwise, don't
generate any diagnostics yet again.
* Apply the old rules again, this time with diagnostics.

This situation was far from ideal, as we would sometimes:
* Accept some things we shouldn't.
* Reject some things we shouldn't.
* Only diagnose rejection in terms of the old rules.

With this patch, we apply the P0522 rules throughout.

This needed to extend template argument deduction in order
to accept the historial rule for TTP matching pack parameter to non-pack
arguments.
This change also makes us accept some combinations of historical and P0522
allowances we wouldn't before.

It also fixes a bunch of bugs that were documented in the test suite,
which I am not sure there are issues already created for them.

This causes a lot of changes to the way these failures are diagnosed,
with related test suite churn.

The problem here is that the old rules were very simple and
non-recursive, making it easy to provide customized diagnostics,
and to keep them consistent with each other.

The new rules are a lot more complex and rely on template argument
deduction, substitutions, and they are recursive.

The approach taken here is to mostly rely on existing diagnostics,
and create a new instantiation context that keeps track of this context.

So for example when a substitution failure occurs, we use the error
produced there unmodified, and just attach notes to it explaining
that it occurred in the context of partial ordering this template
argument against that template parameter.

This diverges from the old diagnostics, which would lead with an
error pointing to the template argument, explain the problem
in subsequent notes, and produce a final note pointing to the parameter.

---
[clang] CWG2398: improve overload resolution backwards compat

With this change, we discriminate if the primary template and which partial
specializations would have participated in overload resolution prior to
P0522 changes.

We collect those in an initial set. If this set is not empty, or the
primary template would have matched, we proceed with this set as the
candidates for overload resolution.

Otherwise, we build a new overload set with everything else, and proceed
as usual.

---
[clang] Implement TTP 'reversed' pack matching for deduced function template calls.

Clang previously missed implementing P0522 pack matching
for deduced function template calls.

show more ...


# 5ede7b6a 22-Jan-2025 Krystian Stasiowski <sdkrystian@gmail.com>

Revert "Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)"" (#123982)

Reverts llvm/llvm-project#109422


# 195a1fc5 22-Jan-2025 Krystian Stasiowski <sdkrystian@gmail.com>

Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (#109422)

Reapplies #104458, fixing a bug that occurs when a class

Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (#109422)

Reapplies #104458, fixing a bug that occurs when a class member access expression calls an `operator->` operator function that returns a non-dependent class type.

show more ...


# 5a7a3242 20-Jan-2025 Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>

[clang][NFC] Migrate bit-fields of OverloadCandidate to LLVM_PREFERRED_TYPE


Revision tags: llvmorg-19.1.7
# cfe26358 11-Jan-2025 Timm Baeder <tbaeder@redhat.com>

Reapply "[clang] Avoid re-evaluating field bitwidth" (#122289)


# 1c999072 09-Jan-2025 Yaxun (Sam) Liu <yaxun.liu@amd.com>

[CUDA][HIP] Fix overriding of constexpr virtual function (#121986)

In C++20 constexpr virtual function is allowed. In C++17 although
non-pure virtual function is not allowed to be constexpr, pure v

[CUDA][HIP] Fix overriding of constexpr virtual function (#121986)

In C++20 constexpr virtual function is allowed. In C++17 although
non-pure virtual function is not allowed to be constexpr, pure virtual
function is allowed to be constexpr and is allowed to be overriden by
non-constexpr virtual function in the derived class.

The following code compiles as C++:

```
class A
{
public:
constexpr virtual int f() = 0;
};

class B : public A
{
public:
int f() override
{
return 42;
}
};
```

However, it fails to compile as CUDA or HIP code. The reason: A::f() is
implicitly host device function whereas B::f() is a host function. Since
they have different targets, clang does not treat B::f() as an override
of A::f(). Instead, it treats B::f() as a name-hiding non-virtual
function for A::f(), and diagnoses it.

This causes any CUDA/HIP program using C++ standard header file
`<format>` from g++-13 to fail to compile since such usage patten show
up there:

```
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/format:3564:34: error: non-virtual member function marked 'override' hides virtual member function
3564 | _M_format_arg(size_t __id) override
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/format:3538:30: note: hidden overloaded virtual function 'std::__format::_Scanner<char>::_M_format_arg' declared here
3538 | constexpr virtual void _M_format_arg(size_t __id) = 0;
| ^
```

This is a serious issue and there is no workaround.

This patch allows non-constexpr function to override constexpr virtual
function for CUDA and HIP. This should be OK since non-constexpr
function without explicit host or device attribute can only be called in
host functions.

Fixes: SWDEV-507350

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 ...


# e50ec3e4 31-Dec-2024 Jan Kokemüller <jan.kokemueller@gmail.com>

[Clang][Sema] Expose static inline functions from GMF (#104701)

In C, it is a common pattern to have `static inline` functions in
headers to avoid ODR issues. Currently, when those headers are incl

[Clang][Sema] Expose static inline functions from GMF (#104701)

In C, it is a common pattern to have `static inline` functions in
headers to avoid ODR issues. Currently, when those headers are included
in a GMF, the names are not found when two-phase name lookup and ADL is
involved. Those names are removed by `Sema::AddOverloadCandidate`.

Similarly, in C++, sometimes people use templates with internal linkage
in headers.

As the GMF was designed to be a transitional mechanism for headers,
special case those functions in `Sema::AddOverloadCandidate`.

This fixes <https://github.com/llvm/llvm-project/issues/98021>.

show more ...


# db93ef14 18-Dec-2024 cor3ntin <corentinjabot@gmail.com>

[Clang] Implement CWG2813: Class member access with prvalues (#120223)

This is a rebase of #95112 with my own feedback apply as @MitalAshok has
been inactive for a while.
It's fairly important this

[Clang] Implement CWG2813: Class member access with prvalues (#120223)

This is a rebase of #95112 with my own feedback apply as @MitalAshok has
been inactive for a while.
It's fairly important this makes clang 20 as it is a blocker for #107451

---

[CWG2813](https://cplusplus.github.io/CWG/issues/2813.html)

prvalue.member_fn(expression-list) now will not materialize a temporary
for prvalue if member_fn is an explicit object member function, and
prvalue will bind directly to the object parameter.

The E1 in E1.static_member is now a discarded-value expression, so if E1
was a call to a [[nodiscard]] function, there will now be a warning.
This also affects C++98 with [[gnu::warn_unused_result]] functions.

This should not affect C where TemporaryMaterializationConversion is a
no-op.

Closes #100314
Fixes #100341

---------

Co-authored-by: Mital Ashok <mital@mitalashok.co.uk>

show more ...


Revision tags: llvmorg-19.1.6
# 9ccde12f 06-Dec-2024 Nathan Ridge <zeratul976@hotmail.com>

[clang] Compute accurate begin location for CallExpr with explicit object parameter (#117841)

The explicit object parameter is written before the callee expression,
so the begin location should com

[clang] Compute accurate begin location for CallExpr with explicit object parameter (#117841)

The explicit object parameter is written before the callee expression,
so the begin location should come from the explicit object parameter.

Fixes https://github.com/llvm/llvm-project/issues/116335

show more ...


# 46de3a70 04-Dec-2024 Sarah Spall <sarahspall@microsoft.com>

[HLSL] get inout/out ABI for array parameters working (#111047)

Get inout/out parameters working for HLSL Arrays.
Utilizes the fix from #109323, and corrects the assignment behavior
slightly to al

[HLSL] get inout/out ABI for array parameters working (#111047)

Get inout/out parameters working for HLSL Arrays.
Utilizes the fix from #109323, and corrects the assignment behavior
slightly to allow for Non-LValues on the RHS.
Closes #106917

---------

Co-authored-by: Chris B <beanz@abolishcrlf.org>

show more ...


Revision tags: llvmorg-19.1.5
# eb5d69c9 26-Nov-2024 Oleksandr T. <oleksandr.tarasiuk@outlook.com>

[Clang] use begin member expr location for call expr with deducing this (#117345)

Fixes #116928


# c22bb6f5 20-Nov-2024 Utkarsh Saxena <usx@google.com>

[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)

This PR uses the existing lifetime analysis for the `capture_by`
attribute.

The analysis is behind `-Wdangling-capture` warn

[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)

This PR uses the existing lifetime analysis for the `capture_by`
attribute.

The analysis is behind `-Wdangling-capture` warning and is disabled by
default for now. Once it is found to be stable, it will be default
enabled.

Planned followup:
- add implicit inference of this attribute on STL container methods like
`std::vector::push_back`.
- (consider) warning if capturing `X` cannot capture anything. It should
be a reference, pointer or a view type.
- refactoring temporary visitors and other related handlers.
- start discussing `__global` vs `global` in the annotation in a
separate PR.

---------

Co-authored-by: Boaz Brickner <brickner@google.com>

show more ...


Revision tags: llvmorg-19.1.4
# 46d750be 16-Nov-2024 Kazu Hirata <kazu@google.com>

[Sema] Remove unused includes (NFC) (#116461)

Identified with misc-include-cleaner.


# b9d678d2 15-Nov-2024 Joseph Huber <huberjn@outlook.com>

[Clang] Use TargetInfo when deciding if an address space is compatible (#115777)

Summary:
Address spaces are used in several embedded and GPU targets to describe
accesses to different types of memo

[Clang] Use TargetInfo when deciding if an address space is compatible (#115777)

Summary:
Address spaces are used in several embedded and GPU targets to describe
accesses to different types of memory. Currently we use the address
space enumerations to control which address spaces are considered
supersets of eachother, however this is also a target level property as
described by the C standard's passing mentions. This patch allows the
address space checks to use the target information to decide if a
pointer conversion is legal. For AMDGPU and NVPTX, all supported address
spaces can be converted to the default address space.

More semantic checks can be added on top of this, for now I'm mainly
looking to get more standard semantics working for C/C++. Right now the
address space conversions must all be done explicitly in C/C++ unlike
the offloading languages which define their own custom address spaces
that just map to the same target specific ones anyway. The main question
is if this behavior is a function of the target or the language.

show more ...


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.


# 3b451207 15-Oct-2024 Helena Kotas <hekotas@microsoft.com>

[HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (#110327)

Translates `RWBuffer` and `StructuredBuffer` resources buffer types to
Di

[HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (#110327)

Translates `RWBuffer` and `StructuredBuffer` resources buffer types to
DirectX target types `dx.TypedBuffer` and `dx.RawBuffer`.

Includes a change of `HLSLAttributesResourceType` from 'sugar' type to
full canonical type. This is required for codegen and other clang
infrastructure to work property on HLSL resource types.

Fixes #95952 (part 2/2)

show more ...


Revision tags: llvmorg-19.1.2
# 3292ce08 12-Oct-2024 Oleksandr T. <oleksandr.tarasiuk@outlook.com>

[Clang] fix overload resolution for object parameters with top-level cv-qualifiers in member functions (#110435)

Fixes #100394


# ed7251b3 11-Oct-2024 Mikhail Goncharov <goncharov.mikhail@gmail.com>

Revert "[clang] Implement TTP P0522 pack matching for deduced function template calls. (#111457)"

See discussion in https://github.com/llvm/llvm-project/pull/111711

This reverts commit 4dadf42c1a74

Revert "[clang] Implement TTP P0522 pack matching for deduced function template calls. (#111457)"

See discussion in https://github.com/llvm/llvm-project/pull/111711

This reverts commit 4dadf42c1a74dd4e37db9ffd6fbb3027f59751a7.

show more ...


# 4dadf42c 10-Oct-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] Implement TTP P0522 pack matching for deduced function template calls. (#111457)

Clang previously missed implementing P0522 pack matching for deduced
function template calls.

Fixes #1113

[clang] Implement TTP P0522 pack matching for deduced function template calls. (#111457)

Clang previously missed implementing P0522 pack matching for deduced
function template calls.

Fixes #111363

show more ...


# d8df1185 01-Oct-2024 Sarah Spall <sarahspall@microsoft.com>

[HLSL] Array by-value assignment (#109323)

Make Constant Arrays in HLSL assignable.
Closes #109043


Revision tags: llvmorg-19.1.1
# 2ad435f9 26-Sep-2024 Kadir Cetinkaya <kadircet@google.com>

Revert "[clang] Extend diagnose_if to accept more detailed warning information (#70976)"

This reverts commit e39205654dc11c50bd117e8ccac243a641ebd71f.

There are further discussions in
https://githu

Revert "[clang] Extend diagnose_if to accept more detailed warning information (#70976)"

This reverts commit e39205654dc11c50bd117e8ccac243a641ebd71f.

There are further discussions in
https://github.com/llvm/llvm-project/pull/70976, happening for past two
weeks. Since there were no responses for couple weeks now, reverting
until author is back.

show more ...


12345678910>>...67