summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-10-24 19:52:31 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-10-24 19:52:31 +0000
commit1b48c5e56bfc33e0faeb7d6a2c0044aa4271720d (patch)
treea360151ede5666ef1c1211181f67a6ce699a375c /clang/lib/CodeGen
parent95af9e654fe5446fa41848b371d11c0a4add1777 (diff)
downloadbcm5719-llvm-1b48c5e56bfc33e0faeb7d6a2c0044aa4271720d.tar.gz
bcm5719-llvm-1b48c5e56bfc33e0faeb7d6a2c0044aa4271720d.zip
[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Fixed passing of VLAs and variably-modified types to outlined functions. Synchronized passing with the types codegen. llvm-svn: 316488
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 0e5ea798ebd..f46ca23c55a 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -254,6 +254,12 @@ static QualType getCanonicalParamType(ASTContext &C, QualType T) {
}
if (T->isPointerType())
return C.getPointerType(getCanonicalParamType(C, T->getPointeeType()));
+ if (auto *A = T->getAsArrayTypeUnsafe()) {
+ if (auto *VLA = dyn_cast<VariableArrayType>(A))
+ return getCanonicalParamType(C, VLA->getElementType());
+ else if (!A->isVariablyModifiedType())
+ return C.getCanonicalType(T);
+ }
return C.getCanonicalParamType(T);
}
@@ -327,7 +333,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
II = &Ctx.Idents.get("vla");
}
if (ArgType->isVariablyModifiedType())
- ArgType = getCanonicalParamType(Ctx, ArgType.getNonReferenceType());
+ ArgType = getCanonicalParamType(Ctx, ArgType);
auto *Arg =
ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(), II,
ArgType, ImplicitParamDecl::Other);
OpenPOWER on IntegriCloud