]> granicus.if.org Git - clang/commitdiff
[OPENMP, C++11] Improve code of InitVLACaptures function.
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 2 Jul 2014 05:15:00 +0000 (05:15 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 2 Jul 2014 05:15:00 +0000 (05:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212162 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp

index 529cca117b4e9a25560b6161bde6a7271a362b35..9cc23e2632a9d7efd67eacf6d3ab15818fb469a2 100644 (file)
@@ -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<ParmVarDecl>(VD))
+        QTy = PVD->getOriginalType();
+      else
+        QTy = VD->getType();
       if (QTy->isVariablyModifiedType()) {
         CGF.EmitVariablyModifiedType(QTy);
       }