summaryrefslogtreecommitdiff
path: root/clang/lib/Sema/ScopeInfo.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-10-29 12:21:55 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-10-29 12:21:55 +0000
commit330de03083138a9e4d93e9877352016c55abd668 (patch)
treefab39bf7b2b2bee4fefcc7e57f6852c00d43b3d6 /clang/lib/Sema/ScopeInfo.cpp
parent77af3812ec50d0ff427cde119ea561e229f50ab2 (diff)
downloadllvm-330de03083138a9e4d93e9877352016c55abd668.tar.gz
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 llvm-svn: 220850
Diffstat (limited to 'clang/lib/Sema/ScopeInfo.cpp')
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index 259cd674c36d..c4bf67b76cda 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/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;
}