summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-11-22 16:02:03 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-11-22 16:02:03 +0000
commitb45d43c397a956ad533829123f476be5c8d3c3ab (patch)
treea60afa9b2ba8b69470173357eda42d22851ab788 /clang/lib/CodeGen/CGStmtOpenMP.cpp
parent511b54cadcc9b87ce1541bd80a1be730f4d687e4 (diff)
downloadbcm5719-llvm-b45d43c397a956ad533829123f476be5c8d3c3ab.tar.gz
bcm5719-llvm-b45d43c397a956ad533829123f476be5c8d3c3ab.zip
[OPENMP] Do not mark captured variables as artificial in debug info.
Captured variables should not be marked as artificial parameters in outlined functions in debug info. llvm-svn: 318843
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 0863cc83aba..697367f7930 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -311,6 +311,16 @@ static llvm::Function *emitOutlinedFunctionPrologue(
CD->param_begin(),
std::next(CD->param_begin(), CD->getContextParamPosition()));
auto I = FO.S->captures().begin();
+ FunctionDecl *DebugFunctionDecl = nullptr;
+ if (!FO.UIntPtrCastRequired) {
+ FunctionProtoType::ExtProtoInfo EPI;
+ DebugFunctionDecl = FunctionDecl::Create(
+ Ctx, Ctx.getTranslationUnitDecl(), FO.S->getLocStart(),
+ SourceLocation(), DeclarationName(), Ctx.VoidTy,
+ Ctx.getTrivialTypeSourceInfo(
+ Ctx.getFunctionType(Ctx.VoidTy, llvm::None, EPI)),
+ SC_Static, /*isInlineSpecified=*/false, /*hasWrittenPrototype=*/false);
+ }
for (auto *FD : RD->fields()) {
QualType ArgType = FD->getType();
IdentifierInfo *II = nullptr;
@@ -338,9 +348,17 @@ static llvm::Function *emitOutlinedFunctionPrologue(
}
if (ArgType->isVariablyModifiedType())
ArgType = getCanonicalParamType(Ctx, ArgType);
- auto *Arg =
- ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(), II,
- ArgType, ImplicitParamDecl::Other);
+ VarDecl *Arg;
+ if (DebugFunctionDecl && (CapVar || I->capturesThis())) {
+ Arg = ParmVarDecl::Create(
+ Ctx, DebugFunctionDecl,
+ CapVar ? CapVar->getLocStart() : FD->getLocStart(),
+ CapVar ? CapVar->getLocation() : FD->getLocation(), II, ArgType,
+ /*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr);
+ } else {
+ Arg = ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(),
+ II, ArgType, ImplicitParamDecl::Other);
+ }
Args.emplace_back(Arg);
// Do not cast arguments if we emit function with non-original types.
TargetArgs.emplace_back(
OpenPOWER on IntegriCloud