Adapt to changed clang::LambdaCapture::getCapturedVar return type
...where <https://github.com/llvm/llvm-project/commit/127bf44385424891eb04cff8e52d3f157fc2cb7c> "[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user