Adapt to changed clang::LambdaCapture::getCapturedVar return type
...where
<127bf44385
>
"[Clang][C++20] Support capturing structured bindings in lambdas" on Clang 16
trunk changed the return type from VarDecl to ValueDecl, causing
> compilerplugins/clang/reducevarscope.cxx:541:26: error: no matching member function for call to 'erase'
> maVarDeclMap.erase(varDecl);
> ~~~~~~~~~~~~~^~~~~
> /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:740:7: note: candidate function not viable: no known conversion from 'ValueDecl *' to 'const_iterator' (aka '_Node_const_iterator<std::pair<const clang::VarDecl *const, (anonymous namespace)::ReduceVarScope::DepthInfo>, __constant_iterators::value, __hash_cached::value>') for 1st argument
> erase(const_iterator __position)
> ^
> /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:745:7: note: candidate function not viable: no known conversion from 'ValueDecl *' to 'iterator' (aka '_Node_iterator<std::pair<const clang::VarDecl *const, (anonymous namespace)::ReduceVarScope::DepthInfo>, __constant_iterators::value, __hash_cached::value>') for 1st argument
> erase(iterator __position)
> ^
> /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:762:7: note: candidate function not viable: cannot convert from base class pointer 'ValueDecl *' to derived class pointer 'const key_type' (aka 'const clang::VarDecl *const') for 1st argument
> erase(const key_type& __x)
> ^
> /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_map.h:780:7: note: candidate function not viable: requires 2 arguments, but 1 was provided
> erase(const_iterator __first, const_iterator __last)
> ^
etc.
Change-Id: I79b062ca604435bc83a58eeb32df673e6c658bd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137984
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
fb992aefc8
commit
cc3e2e7efa
1 changed files with 1 additions and 1 deletions
|
@ -537,7 +537,7 @@ bool ReduceVarScope::VisitLambdaExpr(const LambdaExpr* lambdaExpr)
|
|||
const LambdaCapture& capture = *captureIt;
|
||||
if (capture.capturesVariable())
|
||||
{
|
||||
auto varDecl = capture.getCapturedVar();
|
||||
auto varDecl = cast<VarDecl>(capture.getCapturedVar());
|
||||
maVarDeclMap.erase(varDecl);
|
||||
maVarUseSourceRangeMap.erase(varDecl);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue