diff options
author | Adam Balogh <adam.balogh@ericsson.com> | 2020-09-11 19:04:38 +0200 |
---|---|---|
committer | Adam Balogh <adam.balogh@ericsson.com> | 2020-09-16 13:16:51 +0200 |
commit | dbd45b2db8e0c396fa20d4c72734c4f31f54af96 (patch) | |
tree | b9eec42d0183fa56abe90886d2d2f12cff741492 /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | 779a2a2edcea89ad5f5bf99eeac90516542159d9 (diff) | |
download | llvm-dbd45b2db8e0c396fa20d4c72734c4f31f54af96.zip llvm-dbd45b2db8e0c396fa20d4c72734c4f31f54af96.tar.gz llvm-dbd45b2db8e0c396fa20d4c72734c4f31f54af96.tar.bz2 |
[ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`
//AST Matcher// `hasBody` is a polymorphic matcher that behaves
differently for loop statements and function declarations. The main
difference is the for functions declarations it does not only call
`FunctionDecl::getBody()` but first checks whether the declaration in
question is that specific declaration which has the body by calling
`FunctionDecl::doesThisDeclarationHaveABody()`. This is achieved by
specialization of the template `GetBodyMatcher`. Unfortunately template
specializations do not catch the descendants of the class for which the
template is specialized. Therefore it does not work correcly for the
descendants of `FunctionDecl`, such as `CXXMethodDecl`,
`CXXConstructorDecl`, `CXXDestructorDecl` etc. This patch fixes this
issue by using a template metaprogram.
The patch also introduces a new matcher `hasAnyBody` which matches
declarations which have a body present in the AST but not necessarily
belonging to that particular declaration.
Differential Revision: https://reviews.llvm.org/D87527
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
0 files changed, 0 insertions, 0 deletions