summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-08-05 09:40:35 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-08-05 09:40:35 +0000
commitb40e4af8459c02b5dda2c6ad07aadfc5fe7719cf (patch)
tree2135487589a48efc7d3d0f086fe039f5a4572ac6 /clang/lib/AST
parentcce6347be5850fa679d3600307735e61e9dfe9fe (diff)
downloadbcm5719-llvm-b40e4af8459c02b5dda2c6ad07aadfc5fe7719cf.tar.gz
bcm5719-llvm-b40e4af8459c02b5dda2c6ad07aadfc5fe7719cf.zip
[AST] ArrayRefize BlockDecl::setCaptures. No functionality change intended.
llvm-svn: 244027
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Decl.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 946d1bae21e..486f2d6ab77 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3757,26 +3757,17 @@ void BlockDecl::setParams(ArrayRef<ParmVarDecl *> NewParamInfo) {
}
}
-void BlockDecl::setCaptures(ASTContext &Context,
- const Capture *begin,
- const Capture *end,
- bool capturesCXXThis) {
- CapturesCXXThis = capturesCXXThis;
-
- if (begin == end) {
- NumCaptures = 0;
- Captures = nullptr;
+void BlockDecl::setCaptures(ASTContext &Context, ArrayRef<Capture> Captures,
+ bool CapturesCXXThis) {
+ this->CapturesCXXThis = CapturesCXXThis;
+ this->NumCaptures = Captures.size();
+
+ if (Captures.empty()) {
+ this->Captures = nullptr;
return;
}
- NumCaptures = end - begin;
-
- // Avoid new Capture[] because we don't want to provide a default
- // constructor.
- size_t allocationSize = NumCaptures * sizeof(Capture);
- void *buffer = Context.Allocate(allocationSize, /*alignment*/sizeof(void*));
- memcpy(buffer, begin, allocationSize);
- Captures = static_cast<Capture*>(buffer);
+ this->Captures = Captures.copy(Context).data();
}
bool BlockDecl::capturesVariable(const VarDecl *variable) const {
OpenPOWER on IntegriCloud