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

[clang] NFC: cleanup check template argument (#124668)


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


# 378dcf61 24-Jan-2025 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Fix may-be incorrect ADL for module local entities (#123931)

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

See the comments for details. We can't get primary context

[C++20] [Modules] Fix may-be incorrect ADL for module local entities (#123931)

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

See the comments for details. We can't get primary context arbitrarily
since the redecl may have different context and information.

There is a TODO for modules specific case, I'd like to make it after
this PR.

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


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

[C++20] [Modules] Correct the visibility of decls in implicit global module of other units in the same TU

See the test for the case. It is similar with
https://github.com/llvm/llvm-project/commit/ba

[C++20] [Modules] Correct the visibility of decls in implicit global module of other units in the same TU

See the test for the case. It is similar with
https://github.com/llvm/llvm-project/commit/baa5b769f2f76baa0ce1ebfe28236dee2c761f0d

show more ...


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

[C++20] [Modules] Make module local decls visible to language linkage in the same module

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

See the issue and the comments in the patch for det

[C++20] [Modules] Make module local decls visible to language linkage in the same module

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

See the issue and the comments in the patch for details.

show more ...


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

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

Identified with misc-include-cleaner.


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
# bdd46cc6 11-Oct-2024 Mikhail Goncharov <goncharov.mikhail@gmail.com>

Revert "[clang] CWG2398: improve overload resolution backwards compat (#107350)"

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

This reverts commit 224519b08945637a85e9798c78286

Revert "[clang] CWG2398: improve overload resolution backwards compat (#107350)"

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

This reverts commit 224519b08945637a85e9798c78286643288f7b77.

show more ...


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


# 224519b0 10-Oct-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] CWG2398: improve overload resolution backwards compat (#107350)

With this change, we discriminate if the primary template and which
partial specializations would have participated in overlo

[clang] CWG2398: improve overload resolution backwards compat (#107350)

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.

show more ...


Revision tags: llvmorg-19.1.1
# 0a42c7c6 25-Sep-2024 Matheus Izvekov <mizvekov@gmail.com>

[clang] fix assert in ADL finding entity in the implicit global module (#109882)

This adds to the assert the implicit global module case as in module
purview.

Fixes #109879


# f5be5cda 22-Sep-2024 Nikolas Klauser <nikolasklauser@berlin.de>

[Clang] Add __builtin_common_type (#99473)

This implements the logic of the `common_type` base template as a
builtin alias. If there should be no `type` member, an empty class is
returned. Otherwi

[Clang] Add __builtin_common_type (#99473)

This implements the logic of the `common_type` base template as a
builtin alias. If there should be no `type` member, an empty class is
returned. Otherwise a specialization of a `type_identity`-like class is
returned. The base template (i.e. `std::common_type`) as well as the
empty class and `type_identity`-like struct are given as arguments to
the builtin.

show more ...


# 7db641af 19-Sep-2024 Youngsuk Kim <youngsuk.kim@hpe.com>

[clang] Don't call raw_string_ostream::flush() (NFC)

Don't call raw_string_ostream::flush(), which is essentially a no-op.
As specified in the docs, raw_string_ostream is always unbuffered


Revision tags: llvmorg-19.1.0
# eec1fac9 03-Sep-2024 cor3ntin <corentinjabot@gmail.com>

[Clang] Fix handling of placeholder variables name in init captures (#107055)

We were incorrectly not deduplicating results when looking up `_` which,
for a lambda init capture, would result in an

[Clang] Fix handling of placeholder variables name in init captures (#107055)

We were incorrectly not deduplicating results when looking up `_` which,
for a lambda init capture, would result in an ambiguous lookup.

The same bug caused some diagnostic notes to be emitted twice.

Fixes #107024

show more ...


Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# e6ec7c8f 15-Jul-2024 Krystian Stasiowski <sdkrystian@gmail.com>

[Clang][AST] Move NamespaceDecl bits to DeclContext (#98567)

Currently, `NamespaceDecl` has a member `AnonOrFirstNamespaceAndFlags`
which stores a few pieces of data:
- a bit indicating whether th

[Clang][AST] Move NamespaceDecl bits to DeclContext (#98567)

Currently, `NamespaceDecl` has a member `AnonOrFirstNamespaceAndFlags`
which stores a few pieces of data:
- a bit indicating whether the namespace was declared `inline`, and
- a bit indicating whether the namespace was declared as a
_nested-namespace-definition_, and
- a pointer a `NamespaceDecl` that either stores:
- a pointer to the first declaration of that namespace if the
declaration is no the first declaration, or
- a pointer to the unnamed namespace that inhabits the namespace
otherwise.

`Redeclarable` already stores a pointer to the first declaration of an
entity, so it's unnecessary to store this in `NamespaceDecl`.
`DeclContext` has 8 bytes in which various bitfields can be stored for a
declaration, so it's not necessary to store these in `NamespaceDecl`
either. We only need to store a pointer to the unnamed namespace that
inhabits the first declaration of a namespace. This patch moves the two
bits currently stored in `NamespaceDecl` to `DeclContext`, and only
stores a pointer to the unnamed namespace that inhabits a namespace in
the first declaration of that namespace. Since `getOriginalNamespace`
always returns the same `NamespaceDecl` as `getFirstDecl`, this function
is removed to avoid confusion.

show more ...


# c22625cb 08-Jul-2024 Aaron Ballman <aaron@aaronballman.com>

[C2y] Remove support for _Imaginary (#97436)

WG14 N3274 removed _Imaginary from Annex G. Clang has never fully
supported Annex G or _Imaginary, so removal is pretty trivial for us.

Note, we are

[C2y] Remove support for _Imaginary (#97436)

WG14 N3274 removed _Imaginary from Annex G. Clang has never fully
supported Annex G or _Imaginary, so removal is pretty trivial for us.

Note, we are keeping _Imaginary as a keyword so that we get better
diagnostic behavior. This is still conforming because _I makes it a
reserved identifier, so it's not available for users to use as an
identifier anyway.

show more ...


# bae2c549 01-Jul-2024 Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>

[clang][NFC] Move documentation of `Sema` functions into `Sema.h`

This patch moves documentation of `Sema` functions from `.cpp` files to `Sema.h` when there was no documentation in the latter, or i

[clang][NFC] Move documentation of `Sema` functions into `Sema.h`

This patch moves documentation of `Sema` functions from `.cpp` files to `Sema.h` when there was no documentation in the latter, or it can be trivially subsumed. More complicated cases when there's less trivial divergence between documentation attached to declaration and the one attached to implementation are left for a later PR that would require review.

It appears that doxygen can find the documentation for a function defined out-of-line even if it's attached to an implementation, and not declaration. But other tools, e.g. clangd, are not as powerful. So this patch significantly improves autocompletion experience for (at least) clangd-based IDEs.

show more ...


# 76864e6a 28-Jun-2024 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[C++20] [Modules] Don't find module for linkage for decls in global
module

Possibly fix https://github.com/llvm/llvm-project/issues/96693

The direct reason is that we are calculating the linkage fo

[C++20] [Modules] Don't find module for linkage for decls in global
module

Possibly fix https://github.com/llvm/llvm-project/issues/96693

The direct reason is that we are calculating the linkage for the
declaration too early so that the linkage got calculated incorrectly.

And after I look into the problem, I found it is completely not
necessary to calculate the linkage there. It is for ModulesTS. So I
simply removes that legacy experimental code and fix the issue.

show more ...


# 790f9318 24-Jun-2024 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[NFC] [Modules] Extract the logic to decide whether the module units belongs to the same module

This patch extracts the logci to decide how we decide the module units
belongs to the same module into

[NFC] [Modules] Extract the logic to decide whether the module units belongs to the same module

This patch extracts the logci to decide how we decide the module units
belongs to the same module into a member function of ASTContext. This is
helpful to refactor the implementation in the future.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7
# f0899964 28-May-2024 Youngsuk Kim <joseph942010@gmail.com>

[clang][Sema] Don't emit 'declared here' note for builtin functions with no decl in source (#93394)

Fixes #93369

---------

Co-authored-by: Timm Baeder <tbaeder@redhat.com>
Co-authored-by: S.

[clang][Sema] Don't emit 'declared here' note for builtin functions with no decl in source (#93394)

Fixes #93369

---------

Co-authored-by: Timm Baeder <tbaeder@redhat.com>
Co-authored-by: S. B. Tam <cpplearner@outlook.com>

show more ...


# a640a2e0 22-May-2024 Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>

[clang] Introduce `SemaRISCV` (#92682)

This patch moves `Sema` functions that are specific for RISC-V into the
new `SemaRISCV` class. This continues previous efforts to split `Sema`
up. Additional

[clang] Introduce `SemaRISCV` (#92682)

This patch moves `Sema` functions that are specific for RISC-V into the
new `SemaRISCV` class. This continues previous efforts to split `Sema`
up. Additional context can be found in
https://github.com/llvm/llvm-project/pull/84184.

This PR is somewhat different from previous PRs on this topic:
1. Splitting out target-specific functions wasn't previously discussed.
It felt quite natural to do, though.
2. I had to make some static function in `SemaChecking.cpp` member
functions of `Sema` in order to use them in `SemaRISCV`.
3. I dropped "RISCV" from identifiers, but decided to leave "RVV"
(RISC-V "V" vector extensions) intact. I think it's an idiomatic
abbreviation at this point, but I'm open to input from contributors in
that area.
4. I repurposed `SemaRISCVVectorLookup.cpp` for `SemaRISCV`.

I think this was a successful experiment, which both helps the goal of
splitting `Sema` up, and shows a way to approach `SemaChecking.cpp`,
which I wasn't sure how to approach before. As we move more
target-specific function out of there, we'll gradually make the checking
"framework" inside `SemaChecking.cpp` public, which is currently a whole
bunch of static functions. This would enable us to move more functions
outside of `SemaChecking.cpp`.

show more ...


# fd87d765 20-May-2024 Krystian Stasiowski <sdkrystian@gmail.com>

[Clang][Sema] Don't build CXXDependentScopeMemberExprs for potentially implicit class member access expressions (#92318)

According to [expr.prim.id.general] p2:
> If an _id-expression_ `E` denotes

[Clang][Sema] Don't build CXXDependentScopeMemberExprs for potentially implicit class member access expressions (#92318)

According to [expr.prim.id.general] p2:
> If an _id-expression_ `E` denotes a non-static non-type member of some
class `C` at a point where the current class is `X` and
> - `E` is potentially evaluated or `C` is `X` or a base class of `X`,
and
> - `E` is not the _id-expression_ of a class member access expression,
and
> - if `E` is a _qualified-id_, `E` is not the un-parenthesized operand
of the unary `&` operator,
>
> the _id-expression_ is transformed into a class member access
expression using `(*this)` as the object expression.

Consider the following:
```
struct A
{
void f0();

template<typename T>
void f1();
};

template<typename T>
struct B : T
{
auto g0() -> decltype(T::f0()); // ok

auto g1() -> decltype(T::template f1<int>()); // error: call to non-static member function without an object argument
};

template struct B<A>;
```

Clang incorrectly rejects the call to `f1` in the _trailing-return-type_
of `g1`. Furthermore, the following snippet results in a crash during
codegen:
```
struct A
{
void f();
};

template<typename T>
struct B : T
{
template<typename U>
static void g();

template<>
void g<int>()
{
return T::f(); // crash here
}
};

template struct B<A>;
```
This happens because we unconditionally build a
`CXXDependentScopeMemberExpr` (with an implicit object expression) for
`T::f` when parsing the template definition, even though we don't know
whether `g` is an implicit object member function yet.

This patch fixes these issues by instead building
`DependentScopeDeclRefExpr`s for such expressions, and only transforming
them into implicit class member access expressions during instantiation.
Since we implemented the MS "unqualified lookup into dependent bases"
extension by building an implicit class member access (and relying on
the first component name of the _nested-name-specifier_ to be looked up
in the context of the object expression during instantiation), we
instead pre-append a fake _nested-name-specifier_ that refers to the
injected-class-name of the enclosing class. This patch also refactors
`Sema::BuildQualifiedDeclarationNameExpr` and
`Sema::BuildQualifiedTemplateIdExpr`, streamlining their implementation
and removing any redundant checks.

show more ...


12345678910>>...34