aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorMax Winkler <max.enrico.winkler@gmail.com>2024-12-03 20:18:16 -0800
committerGitHub <noreply@github.com>2024-12-03 20:18:16 -0800
commit95566af789d208b8fc422644ab282a43911041f2 (patch)
tree59e7514ff1ad0f4b39ba0c6a1191f4d54f84ec65 /llvm/lib/CodeGen/MachineOperand.cpp
parentf947d5afd951fe0883e8afe2d00c00d6a97e29bd (diff)
downloadllvm-95566af789d208b8fc422644ab282a43911041f2.zip
llvm-95566af789d208b8fc422644ab282a43911041f2.tar.gz
llvm-95566af789d208b8fc422644ab282a43911041f2.tar.bz2
[Clang][AST] Fix MS Mangle concept uneval context template instantiation crash (#117845)
Fixes https://github.com/llvm/llvm-project/issues/115990. MSVC mangling got inadvertently broken here, https://github.com/llvm/llvm-project/pull/83997, when it was fixed what decl context a lambda is apart of for uneval contexts. https://godbolt.org/z/K6jb5v145 for reference. Given the following code snippet ``` template <typename T> concept C = requires(const T& t) { { T::test([](){}) }; }; template<typename T, typename = void> struct Widget; template <C T> struct Widget<T> {}; struct Baz { template<typename F> static constexpr decltype(auto) test(F&& f) {} }; void test() { Widget<Baz> w; } ``` `Baz::test` has a deduced return type which means we must instantiate that template even in an unevaluated context. The lambda inside the concept is within the decl context of `struct Widget<T> {};`. So we end up needing to mangle a name of `Baz::test<Widget<template-type-0-0>::lambda()>>()` since the lambda isn't apart of an instantiated substituted class `Widget` yet at the point the lambda is instantiated. Upon template instantation of `test` we end up asking for the mangled name so we can add this instantiation to `CodeGenModule::DefferredDecls` since `test` is now referenced but not yet used. I think the longer term more correct solution is to key `DefferedDecls` off of something else than the mangled name to avoid having to mangle names for instantations that are referenced but will never be used since they are only instantiated from an unevaluated context. As a fix for the regression I just created a custom mangling scheme for this case since MSVC has no comparable naming scheme as such a template will never be emitted into the resulting obj as it will never be used.
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
0 files changed, 0 insertions, 0 deletions