From: Alexey Bataev Date: Wed, 2 Jul 2014 05:15:00 +0000 (+0000) Subject: [OPENMP, C++11] Improve code of InitVLACaptures function. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a02dd69660a2b4dcd3745ecf59bf81cb98476fd;p=clang [OPENMP, C++11] Improve code of InitVLACaptures function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212162 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 529cca117b..9cc23e2632 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/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); }