diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-29 12:21:55 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-29 12:21:55 +0000 |
commit | 4ed019aabebd185a56a7cfa155739ca646452047 (patch) | |
tree | fe9e8c8ea34e1e6600e1c0c6d52e8d683c6bb8a6 /lib/Sema/ScopeInfo.cpp | |
parent | 5926ec6f1e60858350ab783dae8cccfae4322c0c (diff) |
Improved capturing variable-length array types in CapturedStmt.
An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas.
This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP.
Differential Revision: http://reviews.llvm.org/D5099
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/ScopeInfo.cpp')
-rw-r--r-- | lib/Sema/ScopeInfo.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/ScopeInfo.cpp b/lib/Sema/ScopeInfo.cpp index 259cd674c3..c4bf67b76c 100644 --- a/lib/Sema/ScopeInfo.cpp +++ b/lib/Sema/ScopeInfo.cpp @@ -95,8 +95,14 @@ FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) { } bool CapturingScopeInfo::isVLATypeCaptured(const VariableArrayType *VAT) const { + RecordDecl *RD = nullptr; if (auto *LSI = dyn_cast<LambdaScopeInfo>(this)) - for (auto *FD : LSI->Lambda->fields()) { + RD = LSI->Lambda; + else if (auto CRSI = dyn_cast<CapturedRegionScopeInfo>(this)) + RD = CRSI->TheRecordDecl; + + if (RD) + for (auto *FD : RD->fields()) { if (FD->hasCapturedVLAType() && FD->getCapturedVLAType() == VAT) return true; } |