diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 21:31:48 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 21:31:48 +0000 |
commit | a7dea1671b87c07d2d266f836bfa8b58efc7c134 (patch) | |
tree | ff67344b3b18fc14e0cec322849afb4e3b94ea56 /contrib/llvm-project/clang/lib/AST/DeclBase.cpp | |
parent | 5c713029ff7939f90b6f96df914953e758855a7f (diff) | |
parent | 519fc96c475680de2cc49e7811dbbfadb912cbcc (diff) |
Notes
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/AST/DeclBase.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/DeclBase.cpp b/contrib/llvm-project/clang/lib/AST/DeclBase.cpp index fd80e1532eb5..77a3a4c679a1 100644 --- a/contrib/llvm-project/clang/lib/AST/DeclBase.cpp +++ b/contrib/llvm-project/clang/lib/AST/DeclBase.cpp @@ -12,6 +12,7 @@ #include "clang/AST/DeclBase.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/ASTLambda.h" #include "clang/AST/ASTMutationListener.h" #include "clang/AST/Attr.h" #include "clang/AST/AttrIterator.h" @@ -99,7 +100,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Ctx, // Ensure required alignment of the resulting object by adding extra // padding at the start if required. size_t ExtraAlign = - llvm::OffsetToAlignment(sizeof(Module *), alignof(Decl)); + llvm::offsetToAlignment(sizeof(Module *), llvm::Align(alignof(Decl))); auto *Buffer = reinterpret_cast<char *>( ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx)); Buffer += ExtraAlign; @@ -958,11 +959,11 @@ const FunctionType *Decl::getFunctionType(bool BlocksToo) const { return nullptr; if (Ty->isFunctionPointerType()) - Ty = Ty->getAs<PointerType>()->getPointeeType(); + Ty = Ty->castAs<PointerType>()->getPointeeType(); else if (Ty->isFunctionReferenceType()) - Ty = Ty->getAs<ReferenceType>()->getPointeeType(); + Ty = Ty->castAs<ReferenceType>()->getPointeeType(); else if (BlocksToo && Ty->isBlockPointerType()) - Ty = Ty->getAs<BlockPointerType>()->getPointeeType(); + Ty = Ty->castAs<BlockPointerType>()->getPointeeType(); return Ty->getAs<FunctionType>(); } @@ -1043,6 +1044,12 @@ DeclContext *DeclContext::getLookupParent() { getLexicalParent()->getRedeclContext()->isRecord()) return getLexicalParent(); + // A lookup within the call operator of a lambda never looks in the lambda + // class; instead, skip to the context in which that closure type is + // declared. + if (isLambdaCallOperator(this)) + return getParent()->getParent(); + return getParent(); } |