From a15539498a3fa0edabfc80d693201ef8513ffae2 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Wed, 2 Jul 2014 05:15:00 +0000 Subject: [OPENMP, C++11] Improve code of InitVLACaptures function. llvm-svn: 212162 --- clang/lib/CodeGen/CGStmt.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CGStmt.cpp') diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 529cca117b4..9cc23e2632a 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -2055,11 +2055,14 @@ static LValue InitCapturedStruct(CodeGenFunction &CGF, const CapturedStmt &S) { } static void InitVLACaptures(CodeGenFunction &CGF, const CapturedStmt &S) { - for (CapturedStmt::const_capture_iterator I = S.capture_begin(), - E = S.capture_end(); - I != E; ++I) { - if (I->capturesVariable()) { - QualType QTy = I->getCapturedVar()->getType(); + for (auto &C : S.captures()) { + if (C.capturesVariable()) { + QualType QTy; + auto VD = C.getCapturedVar(); + if (const ParmVarDecl *PVD = dyn_cast(VD)) + QTy = PVD->getOriginalType(); + else + QTy = VD->getType(); if (QTy->isVariablyModifiedType()) { CGF.EmitVariablyModifiedType(QTy); } -- cgit v1.2.3