llvm-capstone/clang
Sirraide d8352e93c1 [Clang] [Sema] Handle placeholders in '.*' expressions (#83103)
When analysing whether we should handle a binary expression as an
overloaded operator call or a builtin operator, we were calling
`checkPlaceholderForOverload()`, which takes care of any placeholders
that are not overload sets—which would usually make sense since those
need to be handled as part of overload resolution.

Unfortunately, we were also doing that for `.*`, which is not
overloadable, and then proceeding to create a builtin operator anyway,
which would crash if the RHS happened to be an unresolved overload set
(due hitting an assertion in `CreateBuiltinBinOp()`—specifically, in one
of its callees—in the `.*` case that makes sure its arguments aren’t
placeholders).

This pr instead makes it so we check for *all* placeholders early if the
operator is `.*`.

It’s worth noting that,
1. In the `.*` case, we now additionally also check for *any*
placeholders (not just non-overload-sets) in the LHS; this shouldn’t
make a difference, however—at least I couldn’t think of a way to trigger
the assertion with an overload set as the LHS of `.*`; it is worth
noting that the assertion in question would also complain if the LHS
happened to be of placeholder type, though.
2. There is another case in which we also don’t perform overload
resolution—namely `=` if the LHS is not of class or enumeration type
after handling non-overload-set placeholders—as in the `.*` case, but
similarly to 1., I first couldn’t think of a way of getting this case to
crash, and secondly, `CreateBuiltinBinOp()` doesn’t seem to care about
placeholders in the LHS or RHS in the `=` case (from what I can tell,
it, or rather one of its callees, only checks that the LHS is not a
pseudo-object type, but those will have already been handled by the call
to `checkPlaceholderForOverload()` by the time we get to this function),
so I don’t think this case suffers from the same problem.

This fixes #53815.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-03-12 17:38:40 -07:00
..
bindings [libclang/python] Bump minimum compatibility to Python 3.6 (#77228) 2024-01-17 01:02:54 -08:00
cmake [CMake][Release] Add option for enabling PGO to release cache file. (#78823) 2024-01-23 11:32:37 -08:00
docs [Clang] [Sema] Handle placeholders in '.*' expressions (#83103) 2024-03-12 17:38:40 -07:00
examples [clang][examples] Remove unused variable 'key' in LLVMPrintFunctionNames.cpp (NFC) 2023-11-07 13:09:20 +08:00
include [Clang] Fixes to immediate-escalating functions (#82281) 2024-02-26 17:03:46 -08:00
lib [Clang] [Sema] Handle placeholders in '.*' expressions (#83103) 2024-03-12 17:38:40 -07:00
runtime
test [Clang] [Sema] Handle placeholders in '.*' expressions (#83103) 2024-03-12 17:38:40 -07:00
tools [clang-format] Fix a regression in dumping the config (#80628) 2024-02-09 13:24:35 -08:00
unittests [Serialization] Record whether the ODR is skipped (#82302) 2024-02-20 16:41:33 -08:00
utils [CMake][PGO] Add option for using an external project to generate profile data (#78879) 2024-02-06 11:49:07 -08:00
www Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" 2024-01-29 14:57:23 -08:00
.clang-format
.clang-tidy [Clang] Revert inintentional changes to cmake committed in 33e5db6e0 2024-01-12 10:59:46 +01:00
.gitignore
CMakeLists.txt Revert "Reland [Clang][CMake] Support perf, LBR, and Instrument CLANG_BOLT options (#69133)" 2024-01-22 14:56:43 -08:00
CodeOwners.rst
INSTALL.txt
LICENSE.TXT
NOTES.txt
README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang forums:
  https://discourse.llvm.org/c/clang/

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/