mirror of https://github.com/microsoft/clang.git
[DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer.
Summary: If the first parameter of the function is the ImplicitParamDecl, codegen automatically marks it as an implicit argument with `this` or `self` pointer. Added internal kind of the ImplicitParamDecl to separate 'this', 'self', 'vtt' and other implicit parameters from other kind of parameters. Reviewers: rjmccall, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33735 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305075 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fd393d9c9b
commit
94b4418c2d
|
@ -851,6 +851,7 @@ protected:
|
||||||
|
|
||||||
class NonParmVarDeclBitfields {
|
class NonParmVarDeclBitfields {
|
||||||
friend class VarDecl;
|
friend class VarDecl;
|
||||||
|
friend class ImplicitParamDecl;
|
||||||
friend class ASTDeclReader;
|
friend class ASTDeclReader;
|
||||||
|
|
||||||
unsigned : NumVarDeclBits;
|
unsigned : NumVarDeclBits;
|
||||||
|
@ -894,6 +895,10 @@ protected:
|
||||||
/// declared in the same block scope. This controls whether we should merge
|
/// declared in the same block scope. This controls whether we should merge
|
||||||
/// the type of this declaration with its previous declaration.
|
/// the type of this declaration with its previous declaration.
|
||||||
unsigned PreviousDeclInSameBlockScope : 1;
|
unsigned PreviousDeclInSameBlockScope : 1;
|
||||||
|
|
||||||
|
/// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or
|
||||||
|
/// something else.
|
||||||
|
unsigned ImplicitParamKind : 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -1376,20 +1381,50 @@ public:
|
||||||
|
|
||||||
class ImplicitParamDecl : public VarDecl {
|
class ImplicitParamDecl : public VarDecl {
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// Defines the kind of the implicit parameter: is this an implicit parameter
|
||||||
|
/// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured
|
||||||
|
/// context or something else.
|
||||||
|
enum ImplicitParamKind : unsigned {
|
||||||
|
ObjCSelf, /// Parameter for Objective-C 'self' argument
|
||||||
|
ObjCCmd, /// Parameter for Objective-C '_cmd' argument
|
||||||
|
CXXThis, /// Parameter for C++ 'this' argument
|
||||||
|
CXXVTT, /// Parameter for C++ virtual table pointers
|
||||||
|
CapturedContext, /// Parameter for captured context
|
||||||
|
Other, /// Other implicit parameter
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Create implicit parameter.
|
||||||
static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
|
static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
|
||||||
SourceLocation IdLoc, IdentifierInfo *Id,
|
SourceLocation IdLoc, IdentifierInfo *Id,
|
||||||
QualType T);
|
QualType T, ImplicitParamKind ParamKind);
|
||||||
|
static ImplicitParamDecl *Create(ASTContext &C, QualType T,
|
||||||
|
ImplicitParamKind ParamKind);
|
||||||
|
|
||||||
static ImplicitParamDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
static ImplicitParamDecl *CreateDeserialized(ASTContext &C, unsigned ID);
|
||||||
|
|
||||||
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc,
|
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc,
|
||||||
IdentifierInfo *Id, QualType Type)
|
IdentifierInfo *Id, QualType Type,
|
||||||
: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
|
ImplicitParamKind ParamKind)
|
||||||
/*tinfo*/ nullptr, SC_None) {
|
: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
|
||||||
|
/*TInfo=*/nullptr, SC_None) {
|
||||||
|
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
|
||||||
setImplicit();
|
setImplicit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
|
||||||
|
: VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
|
||||||
|
SourceLocation(), /*Id=*/nullptr, Type,
|
||||||
|
/*TInfo=*/nullptr, SC_None) {
|
||||||
|
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
|
||||||
|
setImplicit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the implicit parameter kind.
|
||||||
|
ImplicitParamKind getParameterKind() const {
|
||||||
|
return static_cast<ImplicitParamKind>(NonParmVarDeclBits.ImplicitParamKind);
|
||||||
|
}
|
||||||
// Implement isa/cast/dyncast/etc.
|
// Implement isa/cast/dyncast/etc.
|
||||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||||
static bool classofKind(Kind K) { return K == ImplicitParam; }
|
static bool classofKind(Kind K) { return K == ImplicitParam; }
|
||||||
|
|
|
@ -2462,10 +2462,9 @@ Decl *ASTNodeImporter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Create the imported parameter.
|
// Create the imported parameter.
|
||||||
ImplicitParamDecl *ToParm
|
auto *ToParm = ImplicitParamDecl::Create(Importer.getToContext(), DC, Loc,
|
||||||
= ImplicitParamDecl::Create(Importer.getToContext(), DC,
|
Name.getAsIdentifierInfo(), T,
|
||||||
Loc, Name.getAsIdentifierInfo(),
|
D->getParameterKind());
|
||||||
T);
|
|
||||||
return Importer.Imported(D, ToParm);
|
return Importer.Imported(D, ToParm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4106,15 +4106,19 @@ void ImplicitParamDecl::anchor() { }
|
||||||
|
|
||||||
ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC,
|
ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
SourceLocation IdLoc,
|
SourceLocation IdLoc,
|
||||||
IdentifierInfo *Id,
|
IdentifierInfo *Id, QualType Type,
|
||||||
QualType Type) {
|
ImplicitParamKind ParamKind) {
|
||||||
return new (C, DC) ImplicitParamDecl(C, DC, IdLoc, Id, Type);
|
return new (C, DC) ImplicitParamDecl(C, DC, IdLoc, Id, Type, ParamKind);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, QualType Type,
|
||||||
|
ImplicitParamKind ParamKind) {
|
||||||
|
return new (C, nullptr) ImplicitParamDecl(C, Type, ParamKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImplicitParamDecl *ImplicitParamDecl::CreateDeserialized(ASTContext &C,
|
ImplicitParamDecl *ImplicitParamDecl::CreateDeserialized(ASTContext &C,
|
||||||
unsigned ID) {
|
unsigned ID) {
|
||||||
return new (C, ID) ImplicitParamDecl(C, nullptr, SourceLocation(), nullptr,
|
return new (C, ID) ImplicitParamDecl(C, QualType(), ImplicitParamKind::Other);
|
||||||
QualType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
|
FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
|
||||||
|
|
|
@ -1070,20 +1070,20 @@ void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
|
||||||
bool selfIsPseudoStrong, selfIsConsumed;
|
bool selfIsPseudoStrong, selfIsConsumed;
|
||||||
QualType selfTy =
|
QualType selfTy =
|
||||||
getSelfType(Context, OID, selfIsPseudoStrong, selfIsConsumed);
|
getSelfType(Context, OID, selfIsPseudoStrong, selfIsConsumed);
|
||||||
ImplicitParamDecl *self
|
auto *Self = ImplicitParamDecl::Create(Context, this, SourceLocation(),
|
||||||
= ImplicitParamDecl::Create(Context, this, SourceLocation(),
|
&Context.Idents.get("self"), selfTy,
|
||||||
&Context.Idents.get("self"), selfTy);
|
ImplicitParamDecl::ObjCSelf);
|
||||||
setSelfDecl(self);
|
setSelfDecl(Self);
|
||||||
|
|
||||||
if (selfIsConsumed)
|
if (selfIsConsumed)
|
||||||
self->addAttr(NSConsumedAttr::CreateImplicit(Context));
|
Self->addAttr(NSConsumedAttr::CreateImplicit(Context));
|
||||||
|
|
||||||
if (selfIsPseudoStrong)
|
if (selfIsPseudoStrong)
|
||||||
self->setARCPseudoStrong(true);
|
Self->setARCPseudoStrong(true);
|
||||||
|
|
||||||
setCmdDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
|
setCmdDecl(ImplicitParamDecl::Create(
|
||||||
&Context.Idents.get("_cmd"),
|
Context, this, SourceLocation(), &Context.Idents.get("_cmd"),
|
||||||
Context.getObjCSelType()));
|
Context.getObjCSelType(), ImplicitParamDecl::ObjCCmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() {
|
ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() {
|
||||||
|
|
|
@ -903,9 +903,8 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
|
||||||
} else {
|
} else {
|
||||||
// Fake up a new variable so that EmitScalarInit doesn't think
|
// Fake up a new variable so that EmitScalarInit doesn't think
|
||||||
// we're referring to the variable in its own initializer.
|
// we're referring to the variable in its own initializer.
|
||||||
ImplicitParamDecl blockFieldPseudoVar(getContext(), /*DC*/ nullptr,
|
ImplicitParamDecl BlockFieldPseudoVar(getContext(), type,
|
||||||
SourceLocation(), /*name*/ nullptr,
|
ImplicitParamDecl::Other);
|
||||||
type);
|
|
||||||
|
|
||||||
// We use one of these or the other depending on whether the
|
// We use one of these or the other depending on whether the
|
||||||
// reference is nested.
|
// reference is nested.
|
||||||
|
@ -919,7 +918,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
|
||||||
// attributed to a reasonable location - otherwise it may be attributed to
|
// attributed to a reasonable location - otherwise it may be attributed to
|
||||||
// locations of subexpressions in the initialization.
|
// locations of subexpressions in the initialization.
|
||||||
LValueBaseInfo BaseInfo(AlignmentSource::Decl, false);
|
LValueBaseInfo BaseInfo(AlignmentSource::Decl, false);
|
||||||
EmitExprAsInit(&l2r, &blockFieldPseudoVar,
|
EmitExprAsInit(&l2r, &BlockFieldPseudoVar,
|
||||||
MakeAddrLValue(blockField, type, BaseInfo),
|
MakeAddrLValue(blockField, type, BaseInfo),
|
||||||
/*captured by init*/ false);
|
/*captured by init*/ false);
|
||||||
}
|
}
|
||||||
|
@ -1264,9 +1263,10 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD,
|
||||||
|
|
||||||
IdentifierInfo *II = &CGM.getContext().Idents.get(".block_descriptor");
|
IdentifierInfo *II = &CGM.getContext().Idents.get(".block_descriptor");
|
||||||
|
|
||||||
ImplicitParamDecl selfDecl(getContext(), const_cast<BlockDecl*>(blockDecl),
|
ImplicitParamDecl SelfDecl(getContext(), const_cast<BlockDecl *>(blockDecl),
|
||||||
SourceLocation(), II, selfTy);
|
SourceLocation(), II, selfTy,
|
||||||
args.push_back(&selfDecl);
|
ImplicitParamDecl::ObjCSelf);
|
||||||
|
args.push_back(&SelfDecl);
|
||||||
|
|
||||||
// Now add the rest of the parameters.
|
// Now add the rest of the parameters.
|
||||||
args.append(blockDecl->param_begin(), blockDecl->param_end());
|
args.append(blockDecl->param_begin(), blockDecl->param_end());
|
||||||
|
@ -1499,12 +1499,12 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
|
||||||
ASTContext &C = getContext();
|
ASTContext &C = getContext();
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl dstDecl(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl DstDecl(getContext(), C.VoidPtrTy,
|
||||||
C.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&dstDecl);
|
args.push_back(&DstDecl);
|
||||||
ImplicitParamDecl srcDecl(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl SrcDecl(getContext(), C.VoidPtrTy,
|
||||||
C.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&srcDecl);
|
args.push_back(&SrcDecl);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
||||||
|
@ -1536,11 +1536,11 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
|
||||||
auto AL = ApplyDebugLocation::CreateArtificial(*this);
|
auto AL = ApplyDebugLocation::CreateArtificial(*this);
|
||||||
llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
|
llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
|
||||||
|
|
||||||
Address src = GetAddrOfLocalVar(&srcDecl);
|
Address src = GetAddrOfLocalVar(&SrcDecl);
|
||||||
src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign);
|
src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign);
|
||||||
src = Builder.CreateBitCast(src, structPtrTy, "block.source");
|
src = Builder.CreateBitCast(src, structPtrTy, "block.source");
|
||||||
|
|
||||||
Address dst = GetAddrOfLocalVar(&dstDecl);
|
Address dst = GetAddrOfLocalVar(&DstDecl);
|
||||||
dst = Address(Builder.CreateLoad(dst), blockInfo.BlockAlign);
|
dst = Address(Builder.CreateLoad(dst), blockInfo.BlockAlign);
|
||||||
dst = Builder.CreateBitCast(dst, structPtrTy, "block.dest");
|
dst = Builder.CreateBitCast(dst, structPtrTy, "block.dest");
|
||||||
|
|
||||||
|
@ -1676,9 +1676,9 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
|
||||||
ASTContext &C = getContext();
|
ASTContext &C = getContext();
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl srcDecl(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl SrcDecl(getContext(), C.VoidPtrTy,
|
||||||
C.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&srcDecl);
|
args.push_back(&SrcDecl);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
||||||
|
@ -1709,7 +1709,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
|
||||||
|
|
||||||
llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
|
llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();
|
||||||
|
|
||||||
Address src = GetAddrOfLocalVar(&srcDecl);
|
Address src = GetAddrOfLocalVar(&SrcDecl);
|
||||||
src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign);
|
src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign);
|
||||||
src = Builder.CreateBitCast(src, structPtrTy, "block");
|
src = Builder.CreateBitCast(src, structPtrTy, "block");
|
||||||
|
|
||||||
|
@ -1918,13 +1918,13 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
|
||||||
QualType R = Context.VoidTy;
|
QualType R = Context.VoidTy;
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl dst(CGF.getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl Dst(CGF.getContext(), Context.VoidPtrTy,
|
||||||
Context.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&dst);
|
args.push_back(&Dst);
|
||||||
|
|
||||||
ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl Src(CGF.getContext(), Context.VoidPtrTy,
|
||||||
Context.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&src);
|
args.push_back(&Src);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
|
CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
|
||||||
|
@ -1955,7 +1955,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
|
||||||
llvm::Type *byrefPtrType = byrefInfo.Type->getPointerTo(0);
|
llvm::Type *byrefPtrType = byrefInfo.Type->getPointerTo(0);
|
||||||
|
|
||||||
// dst->x
|
// dst->x
|
||||||
Address destField = CGF.GetAddrOfLocalVar(&dst);
|
Address destField = CGF.GetAddrOfLocalVar(&Dst);
|
||||||
destField = Address(CGF.Builder.CreateLoad(destField),
|
destField = Address(CGF.Builder.CreateLoad(destField),
|
||||||
byrefInfo.ByrefAlignment);
|
byrefInfo.ByrefAlignment);
|
||||||
destField = CGF.Builder.CreateBitCast(destField, byrefPtrType);
|
destField = CGF.Builder.CreateBitCast(destField, byrefPtrType);
|
||||||
|
@ -1963,7 +1963,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
|
||||||
"dest-object");
|
"dest-object");
|
||||||
|
|
||||||
// src->x
|
// src->x
|
||||||
Address srcField = CGF.GetAddrOfLocalVar(&src);
|
Address srcField = CGF.GetAddrOfLocalVar(&Src);
|
||||||
srcField = Address(CGF.Builder.CreateLoad(srcField),
|
srcField = Address(CGF.Builder.CreateLoad(srcField),
|
||||||
byrefInfo.ByrefAlignment);
|
byrefInfo.ByrefAlignment);
|
||||||
srcField = CGF.Builder.CreateBitCast(srcField, byrefPtrType);
|
srcField = CGF.Builder.CreateBitCast(srcField, byrefPtrType);
|
||||||
|
@ -1995,9 +1995,9 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
|
||||||
QualType R = Context.VoidTy;
|
QualType R = Context.VoidTy;
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl Src(CGF.getContext(), Context.VoidPtrTy,
|
||||||
Context.VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&src);
|
args.push_back(&Src);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
|
CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
|
||||||
|
@ -2026,7 +2026,7 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
|
||||||
CGF.StartFunction(FD, R, Fn, FI, args);
|
CGF.StartFunction(FD, R, Fn, FI, args);
|
||||||
|
|
||||||
if (generator.needsDispose()) {
|
if (generator.needsDispose()) {
|
||||||
Address addr = CGF.GetAddrOfLocalVar(&src);
|
Address addr = CGF.GetAddrOfLocalVar(&Src);
|
||||||
addr = Address(CGF.Builder.CreateLoad(addr), byrefInfo.ByrefAlignment);
|
addr = Address(CGF.Builder.CreateLoad(addr), byrefInfo.ByrefAlignment);
|
||||||
auto byrefPtrType = byrefInfo.Type->getPointerTo(0);
|
auto byrefPtrType = byrefInfo.Type->getPointerTo(0);
|
||||||
addr = CGF.Builder.CreateBitCast(addr, byrefPtrType);
|
addr = CGF.Builder.CreateBitCast(addr, byrefPtrType);
|
||||||
|
|
|
@ -159,10 +159,10 @@ void CGCXXABI::buildThisParam(CodeGenFunction &CGF, FunctionArgList ¶ms) {
|
||||||
|
|
||||||
// FIXME: I'm not entirely sure I like using a fake decl just for code
|
// FIXME: I'm not entirely sure I like using a fake decl just for code
|
||||||
// generation. Maybe we can come up with a better way?
|
// generation. Maybe we can come up with a better way?
|
||||||
ImplicitParamDecl *ThisDecl
|
auto *ThisDecl = ImplicitParamDecl::Create(
|
||||||
= ImplicitParamDecl::Create(CGM.getContext(), nullptr, MD->getLocation(),
|
CGM.getContext(), nullptr, MD->getLocation(),
|
||||||
&CGM.getContext().Idents.get("this"),
|
&CGM.getContext().Idents.get("this"), MD->getThisType(CGM.getContext()),
|
||||||
MD->getThisType(CGM.getContext()));
|
ImplicitParamDecl::CXXThis);
|
||||||
params.push_back(ThisDecl);
|
params.push_back(ThisDecl);
|
||||||
CGF.CXXABIThisDecl = ThisDecl;
|
CGF.CXXABIThisDecl = ThisDecl;
|
||||||
|
|
||||||
|
|
|
@ -3466,13 +3466,13 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage,
|
||||||
unsigned AddressSpace = CGM.getContext().getTargetAddressSpace(VD->getType());
|
unsigned AddressSpace = CGM.getContext().getTargetAddressSpace(VD->getType());
|
||||||
AppendAddressSpaceXDeref(AddressSpace, Expr);
|
AppendAddressSpaceXDeref(AddressSpace, Expr);
|
||||||
|
|
||||||
// If this is the first argument and it is implicit then
|
// If this is implicit parameter and has IPK_CXXThis or IPK_ObjCSelf attribute
|
||||||
// give it an object pointer flag.
|
// then give it an object pointer flag.
|
||||||
// FIXME: There has to be a better way to do this, but for static
|
if (const auto *IPD = dyn_cast<ImplicitParamDecl>(VD)) {
|
||||||
// functions there won't be an implicit param at arg1 and
|
if (IPD->getParameterKind() == ImplicitParamDecl::CXXThis ||
|
||||||
// otherwise it is 'self' or 'this'.
|
IPD->getParameterKind() == ImplicitParamDecl::ObjCSelf)
|
||||||
if (isa<ImplicitParamDecl>(VD) && ArgNo && *ArgNo == 1)
|
Flags |= llvm::DINode::FlagObjectPointer;
|
||||||
Flags |= llvm::DINode::FlagObjectPointer;
|
}
|
||||||
|
|
||||||
// Note: Older versions of clang used to emit byval references with an extra
|
// Note: Older versions of clang used to emit byval references with an extra
|
||||||
// DW_OP_deref, because they referenced the IR arg directly instead of
|
// DW_OP_deref, because they referenced the IR arg directly instead of
|
||||||
|
@ -3583,8 +3583,9 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
|
||||||
|
|
||||||
// Self is passed along as an implicit non-arg variable in a
|
// Self is passed along as an implicit non-arg variable in a
|
||||||
// block. Mark it as the object pointer.
|
// block. Mark it as the object pointer.
|
||||||
if (isa<ImplicitParamDecl>(VD) && VD->getName() == "self")
|
if (const auto *IPD = dyn_cast<ImplicitParamDecl>(VD))
|
||||||
Ty = CreateSelfType(VD->getType(), Ty);
|
if (IPD->getParameterKind() == ImplicitParamDecl::ObjCSelf)
|
||||||
|
Ty = CreateSelfType(VD->getType(), Ty);
|
||||||
|
|
||||||
// Get location information.
|
// Get location information.
|
||||||
unsigned Line = getLineNumber(VD->getLocation());
|
unsigned Line = getLineNumber(VD->getLocation());
|
||||||
|
|
|
@ -603,9 +603,9 @@ llvm::Function *CodeGenFunction::generateDestroyHelper(
|
||||||
Address addr, QualType type, Destroyer *destroyer,
|
Address addr, QualType type, Destroyer *destroyer,
|
||||||
bool useEHCleanupForArray, const VarDecl *VD) {
|
bool useEHCleanupForArray, const VarDecl *VD) {
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl dst(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl Dst(getContext(), getContext().VoidPtrTy,
|
||||||
getContext().VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
args.push_back(&dst);
|
args.push_back(&Dst);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGM.getTypes().arrangeBuiltinFunctionDeclaration(getContext().VoidTy, args);
|
CGM.getTypes().arrangeBuiltinFunctionDeclaration(getContext().VoidTy, args);
|
||||||
|
|
|
@ -1649,18 +1649,19 @@ void CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
|
||||||
// parameters. Win32 filters take no parameters.
|
// parameters. Win32 filters take no parameters.
|
||||||
if (IsFilter) {
|
if (IsFilter) {
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
getContext(), nullptr, StartLoc,
|
getContext(), /*DC=*/nullptr, StartLoc,
|
||||||
&getContext().Idents.get("exception_pointers"),
|
&getContext().Idents.get("exception_pointers"),
|
||||||
getContext().VoidPtrTy));
|
getContext().VoidPtrTy, ImplicitParamDecl::Other));
|
||||||
} else {
|
} else {
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
getContext(), nullptr, StartLoc,
|
getContext(), /*DC=*/nullptr, StartLoc,
|
||||||
&getContext().Idents.get("abnormal_termination"),
|
&getContext().Idents.get("abnormal_termination"),
|
||||||
getContext().UnsignedCharTy));
|
getContext().UnsignedCharTy, ImplicitParamDecl::Other));
|
||||||
}
|
}
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
getContext(), nullptr, StartLoc,
|
getContext(), /*DC=*/nullptr, StartLoc,
|
||||||
&getContext().Idents.get("frame_pointer"), getContext().VoidPtrTy));
|
&getContext().Idents.get("frame_pointer"), getContext().VoidPtrTy,
|
||||||
|
ImplicitParamDecl::Other));
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType RetTy = IsFilter ? getContext().LongTy : getContext().VoidTy;
|
QualType RetTy = IsFilter ? getContext().LongTy : getContext().VoidTy;
|
||||||
|
|
|
@ -2847,10 +2847,10 @@ void CodeGenFunction::EmitCfiCheckStub() {
|
||||||
void CodeGenFunction::EmitCfiCheckFail() {
|
void CodeGenFunction::EmitCfiCheckFail() {
|
||||||
SanitizerScope SanScope(this);
|
SanitizerScope SanScope(this);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl ArgData(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl ArgData(getContext(), getContext().VoidPtrTy,
|
||||||
getContext().VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl ArgAddr(getContext(), nullptr, SourceLocation(), nullptr,
|
ImplicitParamDecl ArgAddr(getContext(), getContext().VoidPtrTy,
|
||||||
getContext().VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&ArgData);
|
Args.push_back(&ArgData);
|
||||||
Args.push_back(&ArgAddr);
|
Args.push_back(&ArgAddr);
|
||||||
|
|
||||||
|
|
|
@ -3246,10 +3246,12 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(
|
||||||
SrcTy = C.getPointerType(SrcTy);
|
SrcTy = C.getPointerType(SrcTy);
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl dstDecl(getContext(), FD, SourceLocation(), nullptr,DestTy);
|
ImplicitParamDecl DstDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
|
||||||
args.push_back(&dstDecl);
|
DestTy, ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl srcDecl(getContext(), FD, SourceLocation(), nullptr, SrcTy);
|
args.push_back(&DstDecl);
|
||||||
args.push_back(&srcDecl);
|
ImplicitParamDecl SrcDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
|
||||||
|
SrcTy, ImplicitParamDecl::Other);
|
||||||
|
args.push_back(&SrcDecl);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
||||||
|
@ -3265,12 +3267,12 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(
|
||||||
|
|
||||||
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
||||||
|
|
||||||
DeclRefExpr DstExpr(&dstDecl, false, DestTy,
|
DeclRefExpr DstExpr(&DstDecl, false, DestTy,
|
||||||
VK_RValue, SourceLocation());
|
VK_RValue, SourceLocation());
|
||||||
UnaryOperator DST(&DstExpr, UO_Deref, DestTy->getPointeeType(),
|
UnaryOperator DST(&DstExpr, UO_Deref, DestTy->getPointeeType(),
|
||||||
VK_LValue, OK_Ordinary, SourceLocation());
|
VK_LValue, OK_Ordinary, SourceLocation());
|
||||||
|
|
||||||
DeclRefExpr SrcExpr(&srcDecl, false, SrcTy,
|
DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy,
|
||||||
VK_RValue, SourceLocation());
|
VK_RValue, SourceLocation());
|
||||||
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
|
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
|
||||||
VK_LValue, OK_Ordinary, SourceLocation());
|
VK_LValue, OK_Ordinary, SourceLocation());
|
||||||
|
@ -3327,10 +3329,12 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
|
||||||
SrcTy = C.getPointerType(SrcTy);
|
SrcTy = C.getPointerType(SrcTy);
|
||||||
|
|
||||||
FunctionArgList args;
|
FunctionArgList args;
|
||||||
ImplicitParamDecl dstDecl(getContext(), FD, SourceLocation(), nullptr,DestTy);
|
ImplicitParamDecl DstDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
|
||||||
args.push_back(&dstDecl);
|
DestTy, ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl srcDecl(getContext(), FD, SourceLocation(), nullptr, SrcTy);
|
args.push_back(&DstDecl);
|
||||||
args.push_back(&srcDecl);
|
ImplicitParamDecl SrcDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
|
||||||
|
SrcTy, ImplicitParamDecl::Other);
|
||||||
|
args.push_back(&SrcDecl);
|
||||||
|
|
||||||
const CGFunctionInfo &FI =
|
const CGFunctionInfo &FI =
|
||||||
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
|
||||||
|
@ -3345,7 +3349,7 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
|
||||||
|
|
||||||
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
||||||
|
|
||||||
DeclRefExpr SrcExpr(&srcDecl, false, SrcTy,
|
DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy,
|
||||||
VK_RValue, SourceLocation());
|
VK_RValue, SourceLocation());
|
||||||
|
|
||||||
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
|
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
|
||||||
|
@ -3371,7 +3375,7 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
|
||||||
CXXConstExpr->getConstructionKind(),
|
CXXConstExpr->getConstructionKind(),
|
||||||
SourceRange());
|
SourceRange());
|
||||||
|
|
||||||
DeclRefExpr DstExpr(&dstDecl, false, DestTy,
|
DeclRefExpr DstExpr(&DstDecl, false, DestTy,
|
||||||
VK_RValue, SourceLocation());
|
VK_RValue, SourceLocation());
|
||||||
|
|
||||||
RValue DV = EmitAnyExpr(&DstExpr);
|
RValue DV = EmitAnyExpr(&DstExpr);
|
||||||
|
|
|
@ -747,9 +747,9 @@ emitCombinerOrInitializer(CodeGenModule &CGM, QualType Ty,
|
||||||
QualType PtrTy = C.getPointerType(Ty).withRestrict();
|
QualType PtrTy = C.getPointerType(Ty).withRestrict();
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl OmpOutParm(C, /*DC=*/nullptr, Out->getLocation(),
|
ImplicitParamDecl OmpOutParm(C, /*DC=*/nullptr, Out->getLocation(),
|
||||||
/*Id=*/nullptr, PtrTy);
|
/*Id=*/nullptr, PtrTy, ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl OmpInParm(C, /*DC=*/nullptr, In->getLocation(),
|
ImplicitParamDecl OmpInParm(C, /*DC=*/nullptr, In->getLocation(),
|
||||||
/*Id=*/nullptr, PtrTy);
|
/*Id=*/nullptr, PtrTy, ImplicitParamDecl::Other);
|
||||||
Args.push_back(&OmpOutParm);
|
Args.push_back(&OmpOutParm);
|
||||||
Args.push_back(&OmpInParm);
|
Args.push_back(&OmpInParm);
|
||||||
auto &FnInfo =
|
auto &FnInfo =
|
||||||
|
@ -1808,8 +1808,8 @@ llvm::Function *CGOpenMPRuntime::emitThreadPrivateVarDefinition(
|
||||||
// threadprivate copy of the variable VD
|
// threadprivate copy of the variable VD
|
||||||
CodeGenFunction CtorCGF(CGM);
|
CodeGenFunction CtorCGF(CGM);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl Dst(CGM.getContext(), /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl Dst(CGM.getContext(), CGM.getContext().VoidPtrTy,
|
||||||
/*Id=*/nullptr, CGM.getContext().VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&Dst);
|
Args.push_back(&Dst);
|
||||||
|
|
||||||
auto &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(
|
auto &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(
|
||||||
|
@ -1839,8 +1839,8 @@ llvm::Function *CGOpenMPRuntime::emitThreadPrivateVarDefinition(
|
||||||
// of the variable VD
|
// of the variable VD
|
||||||
CodeGenFunction DtorCGF(CGM);
|
CodeGenFunction DtorCGF(CGM);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl Dst(CGM.getContext(), /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl Dst(CGM.getContext(), CGM.getContext().VoidPtrTy,
|
||||||
/*Id=*/nullptr, CGM.getContext().VoidPtrTy);
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&Dst);
|
Args.push_back(&Dst);
|
||||||
|
|
||||||
auto &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(
|
auto &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(
|
||||||
|
@ -2191,10 +2191,8 @@ static llvm::Value *emitCopyprivateCopyFunction(
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
// void copy_func(void *LHSArg, void *RHSArg);
|
// void copy_func(void *LHSArg, void *RHSArg);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl LHSArg(C, /*DC=*/nullptr, SourceLocation(), /*Id=*/nullptr,
|
ImplicitParamDecl LHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
C.VoidPtrTy);
|
ImplicitParamDecl RHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl RHSArg(C, /*DC=*/nullptr, SourceLocation(), /*Id=*/nullptr,
|
|
||||||
C.VoidPtrTy);
|
|
||||||
Args.push_back(&LHSArg);
|
Args.push_back(&LHSArg);
|
||||||
Args.push_back(&RHSArg);
|
Args.push_back(&RHSArg);
|
||||||
auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);
|
auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);
|
||||||
|
@ -2785,8 +2783,7 @@ createOffloadingBinaryDescriptorFunction(CodeGenModule &CGM, StringRef Name,
|
||||||
const RegionCodeGenTy &Codegen) {
|
const RegionCodeGenTy &Codegen) {
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl DummyPtr(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl DummyPtr(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
Args.push_back(&DummyPtr);
|
Args.push_back(&DummyPtr);
|
||||||
|
|
||||||
CodeGenFunction CGF(CGM);
|
CodeGenFunction CGF(CGM);
|
||||||
|
@ -2889,7 +2886,7 @@ CGOpenMPRuntime::createOffloadingBinaryDescriptorRegistration() {
|
||||||
// descriptor, so we can reuse the logic that emits Ctors and Dtors.
|
// descriptor, so we can reuse the logic that emits Ctors and Dtors.
|
||||||
auto *IdentInfo = &C.Idents.get(".omp_offloading.reg_unreg_var");
|
auto *IdentInfo = &C.Idents.get(".omp_offloading.reg_unreg_var");
|
||||||
ImplicitParamDecl RegUnregVar(C, C.getTranslationUnitDecl(), SourceLocation(),
|
ImplicitParamDecl RegUnregVar(C, C.getTranslationUnitDecl(), SourceLocation(),
|
||||||
IdentInfo, C.CharTy);
|
IdentInfo, C.CharTy, ImplicitParamDecl::Other);
|
||||||
|
|
||||||
auto *UnRegFn = createOffloadingBinaryDescriptorFunction(
|
auto *UnRegFn = createOffloadingBinaryDescriptorFunction(
|
||||||
CGM, ".omp_offloading.descriptor_unreg",
|
CGM, ".omp_offloading.descriptor_unreg",
|
||||||
|
@ -3319,10 +3316,11 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc,
|
||||||
llvm::Value *TaskPrivatesMap) {
|
llvm::Value *TaskPrivatesMap) {
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl GtidArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, KmpInt32Ty);
|
ImplicitParamDecl GtidArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, KmpInt32Ty,
|
||||||
ImplicitParamDecl TaskTypeArg(C, /*DC=*/nullptr, Loc,
|
ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr,
|
ImplicitParamDecl TaskTypeArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
KmpTaskTWithPrivatesPtrQTy.withRestrict());
|
KmpTaskTWithPrivatesPtrQTy.withRestrict(),
|
||||||
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&GtidArg);
|
Args.push_back(&GtidArg);
|
||||||
Args.push_back(&TaskTypeArg);
|
Args.push_back(&TaskTypeArg);
|
||||||
auto &TaskEntryFnInfo =
|
auto &TaskEntryFnInfo =
|
||||||
|
@ -3413,10 +3411,11 @@ static llvm::Value *emitDestructorsFunction(CodeGenModule &CGM,
|
||||||
QualType KmpTaskTWithPrivatesQTy) {
|
QualType KmpTaskTWithPrivatesQTy) {
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl GtidArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, KmpInt32Ty);
|
ImplicitParamDecl GtidArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, KmpInt32Ty,
|
||||||
ImplicitParamDecl TaskTypeArg(C, /*DC=*/nullptr, Loc,
|
ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr,
|
ImplicitParamDecl TaskTypeArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
KmpTaskTWithPrivatesPtrQTy.withRestrict());
|
KmpTaskTWithPrivatesPtrQTy.withRestrict(),
|
||||||
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&GtidArg);
|
Args.push_back(&GtidArg);
|
||||||
Args.push_back(&TaskTypeArg);
|
Args.push_back(&TaskTypeArg);
|
||||||
FunctionType::ExtInfo Info;
|
FunctionType::ExtInfo Info;
|
||||||
|
@ -3472,36 +3471,40 @@ emitTaskPrivateMappingFunction(CodeGenModule &CGM, SourceLocation Loc,
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl TaskPrivatesArg(
|
ImplicitParamDecl TaskPrivatesArg(
|
||||||
C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
C.getPointerType(PrivatesQTy).withConst().withRestrict());
|
C.getPointerType(PrivatesQTy).withConst().withRestrict(),
|
||||||
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&TaskPrivatesArg);
|
Args.push_back(&TaskPrivatesArg);
|
||||||
llvm::DenseMap<const VarDecl *, unsigned> PrivateVarsPos;
|
llvm::DenseMap<const VarDecl *, unsigned> PrivateVarsPos;
|
||||||
unsigned Counter = 1;
|
unsigned Counter = 1;
|
||||||
for (auto *E: PrivateVars) {
|
for (auto *E: PrivateVars) {
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
C, /*DC=*/nullptr, Loc,
|
C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
/*Id=*/nullptr, C.getPointerType(C.getPointerType(E->getType()))
|
C.getPointerType(C.getPointerType(E->getType()))
|
||||||
.withConst()
|
.withConst()
|
||||||
.withRestrict()));
|
.withRestrict(),
|
||||||
|
ImplicitParamDecl::Other));
|
||||||
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
||||||
PrivateVarsPos[VD] = Counter;
|
PrivateVarsPos[VD] = Counter;
|
||||||
++Counter;
|
++Counter;
|
||||||
}
|
}
|
||||||
for (auto *E : FirstprivateVars) {
|
for (auto *E : FirstprivateVars) {
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
C, /*DC=*/nullptr, Loc,
|
C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
/*Id=*/nullptr, C.getPointerType(C.getPointerType(E->getType()))
|
C.getPointerType(C.getPointerType(E->getType()))
|
||||||
.withConst()
|
.withConst()
|
||||||
.withRestrict()));
|
.withRestrict(),
|
||||||
|
ImplicitParamDecl::Other));
|
||||||
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
||||||
PrivateVarsPos[VD] = Counter;
|
PrivateVarsPos[VD] = Counter;
|
||||||
++Counter;
|
++Counter;
|
||||||
}
|
}
|
||||||
for (auto *E: LastprivateVars) {
|
for (auto *E: LastprivateVars) {
|
||||||
Args.push_back(ImplicitParamDecl::Create(
|
Args.push_back(ImplicitParamDecl::Create(
|
||||||
C, /*DC=*/nullptr, Loc,
|
C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
/*Id=*/nullptr, C.getPointerType(C.getPointerType(E->getType()))
|
C.getPointerType(C.getPointerType(E->getType()))
|
||||||
.withConst()
|
.withConst()
|
||||||
.withRestrict()));
|
.withRestrict(),
|
||||||
|
ImplicitParamDecl::Other));
|
||||||
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
|
||||||
PrivateVarsPos[VD] = Counter;
|
PrivateVarsPos[VD] = Counter;
|
||||||
++Counter;
|
++Counter;
|
||||||
|
@ -3661,12 +3664,14 @@ emitTaskDupFunction(CodeGenModule &CGM, SourceLocation Loc,
|
||||||
ArrayRef<PrivateDataTy> Privates, bool WithLastIter) {
|
ArrayRef<PrivateDataTy> Privates, bool WithLastIter) {
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl DstArg(C, /*DC=*/nullptr, Loc,
|
ImplicitParamDecl DstArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
/*Id=*/nullptr, KmpTaskTWithPrivatesPtrQTy);
|
KmpTaskTWithPrivatesPtrQTy,
|
||||||
ImplicitParamDecl SrcArg(C, /*DC=*/nullptr, Loc,
|
ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, KmpTaskTWithPrivatesPtrQTy);
|
ImplicitParamDecl SrcArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,
|
||||||
ImplicitParamDecl LastprivArg(C, /*DC=*/nullptr, Loc,
|
KmpTaskTWithPrivatesPtrQTy,
|
||||||
/*Id=*/nullptr, C.IntTy);
|
ImplicitParamDecl::Other);
|
||||||
|
ImplicitParamDecl LastprivArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.IntTy,
|
||||||
|
ImplicitParamDecl::Other);
|
||||||
Args.push_back(&DstArg);
|
Args.push_back(&DstArg);
|
||||||
Args.push_back(&SrcArg);
|
Args.push_back(&SrcArg);
|
||||||
Args.push_back(&LastprivArg);
|
Args.push_back(&LastprivArg);
|
||||||
|
@ -4278,10 +4283,8 @@ llvm::Value *CGOpenMPRuntime::emitReductionFunction(
|
||||||
|
|
||||||
// void reduction_func(void *LHSArg, void *RHSArg);
|
// void reduction_func(void *LHSArg, void *RHSArg);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
ImplicitParamDecl LHSArg(C, /*DC=*/nullptr, SourceLocation(), /*Id=*/nullptr,
|
ImplicitParamDecl LHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
C.VoidPtrTy);
|
ImplicitParamDecl RHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
ImplicitParamDecl RHSArg(C, /*DC=*/nullptr, SourceLocation(), /*Id=*/nullptr,
|
|
||||||
C.VoidPtrTy);
|
|
||||||
Args.push_back(&LHSArg);
|
Args.push_back(&LHSArg);
|
||||||
Args.push_back(&RHSArg);
|
Args.push_back(&RHSArg);
|
||||||
auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);
|
auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);
|
||||||
|
|
|
@ -1252,24 +1252,19 @@ emitReduceScratchpadFunction(CodeGenModule &CGM,
|
||||||
auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);
|
auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);
|
||||||
|
|
||||||
// Destination of the copy.
|
// Destination of the copy.
|
||||||
ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// Base address of the scratchpad array, with each element storing a
|
// Base address of the scratchpad array, with each element storing a
|
||||||
// Reduce list per team.
|
// Reduce list per team.
|
||||||
ImplicitParamDecl ScratchPadArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ScratchPadArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// A source index into the scratchpad array.
|
// A source index into the scratchpad array.
|
||||||
ImplicitParamDecl IndexArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl IndexArg(C, Int32Ty, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, Int32Ty);
|
|
||||||
// Row width of an element in the scratchpad array, typically
|
// Row width of an element in the scratchpad array, typically
|
||||||
// the number of teams.
|
// the number of teams.
|
||||||
ImplicitParamDecl WidthArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl WidthArg(C, Int32Ty, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, Int32Ty);
|
|
||||||
// If should_reduce == 1, then it's load AND reduce,
|
// If should_reduce == 1, then it's load AND reduce,
|
||||||
// If should_reduce == 0 (or otherwise), then it only loads (+ copy).
|
// If should_reduce == 0 (or otherwise), then it only loads (+ copy).
|
||||||
// The latter case is used for initialization.
|
// The latter case is used for initialization.
|
||||||
ImplicitParamDecl ShouldReduceArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ShouldReduceArg(C, Int32Ty, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, Int32Ty);
|
|
||||||
|
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
Args.push_back(&ReduceListArg);
|
Args.push_back(&ReduceListArg);
|
||||||
|
@ -1381,20 +1376,16 @@ static llvm::Value *emitCopyToScratchpad(CodeGenModule &CGM,
|
||||||
auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);
|
auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);
|
||||||
|
|
||||||
// Source of the copy.
|
// Source of the copy.
|
||||||
ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// Base address of the scratchpad array, with each element storing a
|
// Base address of the scratchpad array, with each element storing a
|
||||||
// Reduce list per team.
|
// Reduce list per team.
|
||||||
ImplicitParamDecl ScratchPadArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ScratchPadArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// A destination index into the scratchpad array, typically the team
|
// A destination index into the scratchpad array, typically the team
|
||||||
// identifier.
|
// identifier.
|
||||||
ImplicitParamDecl IndexArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl IndexArg(C, Int32Ty, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, Int32Ty);
|
|
||||||
// Row width of an element in the scratchpad array, typically
|
// Row width of an element in the scratchpad array, typically
|
||||||
// the number of teams.
|
// the number of teams.
|
||||||
ImplicitParamDecl WidthArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl WidthArg(C, Int32Ty, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, Int32Ty);
|
|
||||||
|
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
Args.push_back(&ReduceListArg);
|
Args.push_back(&ReduceListArg);
|
||||||
|
@ -1475,13 +1466,12 @@ static llvm::Value *emitInterWarpCopyFunction(CodeGenModule &CGM,
|
||||||
// ReduceList: thread local Reduce list.
|
// ReduceList: thread local Reduce list.
|
||||||
// At the stage of the computation when this function is called, partially
|
// At the stage of the computation when this function is called, partially
|
||||||
// aggregated values reside in the first lane of every active warp.
|
// aggregated values reside in the first lane of every active warp.
|
||||||
ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// NumWarps: number of warps active in the parallel region. This could
|
// NumWarps: number of warps active in the parallel region. This could
|
||||||
// be smaller than 32 (max warps in a CTA) for partial block reduction.
|
// be smaller than 32 (max warps in a CTA) for partial block reduction.
|
||||||
ImplicitParamDecl NumWarpsArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl NumWarpsArg(C,
|
||||||
/*Id=*/nullptr,
|
C.getIntTypeForBitwidth(32, /* Signed */ true),
|
||||||
C.getIntTypeForBitwidth(32, /* Signed */ true));
|
ImplicitParamDecl::Other);
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
Args.push_back(&ReduceListArg);
|
Args.push_back(&ReduceListArg);
|
||||||
Args.push_back(&NumWarpsArg);
|
Args.push_back(&NumWarpsArg);
|
||||||
|
@ -1723,17 +1713,14 @@ emitShuffleAndReduceFunction(CodeGenModule &CGM,
|
||||||
auto &C = CGM.getContext();
|
auto &C = CGM.getContext();
|
||||||
|
|
||||||
// Thread local Reduce list used to host the values of data to be reduced.
|
// Thread local Reduce list used to host the values of data to be reduced.
|
||||||
ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.VoidPtrTy);
|
|
||||||
// Current lane id; could be logical.
|
// Current lane id; could be logical.
|
||||||
ImplicitParamDecl LaneIDArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl LaneIDArg(C, C.ShortTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.ShortTy);
|
|
||||||
// Offset of the remote source lane relative to the current lane.
|
// Offset of the remote source lane relative to the current lane.
|
||||||
ImplicitParamDecl RemoteLaneOffsetArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl RemoteLaneOffsetArg(C, C.ShortTy,
|
||||||
/*Id=*/nullptr, C.ShortTy);
|
ImplicitParamDecl::Other);
|
||||||
// Algorithm version. This is expected to be known at compile time.
|
// Algorithm version. This is expected to be known at compile time.
|
||||||
ImplicitParamDecl AlgoVerArg(C, /*DC=*/nullptr, SourceLocation(),
|
ImplicitParamDecl AlgoVerArg(C, C.ShortTy, ImplicitParamDecl::Other);
|
||||||
/*Id=*/nullptr, C.ShortTy);
|
|
||||||
FunctionArgList Args;
|
FunctionArgList Args;
|
||||||
Args.push_back(&ReduceListArg);
|
Args.push_back(&ReduceListArg);
|
||||||
Args.push_back(&LaneIDArg);
|
Args.push_back(&LaneIDArg);
|
||||||
|
|
|
@ -281,8 +281,9 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) {
|
||||||
ArgType =
|
ArgType =
|
||||||
getCanonicalParamType(getContext(), ArgType.getNonReferenceType());
|
getCanonicalParamType(getContext(), ArgType.getNonReferenceType());
|
||||||
}
|
}
|
||||||
Args.push_back(ImplicitParamDecl::Create(getContext(), nullptr,
|
Args.push_back(ImplicitParamDecl::Create(getContext(), /*DC=*/nullptr,
|
||||||
FD->getLocation(), II, ArgType));
|
FD->getLocation(), II, ArgType,
|
||||||
|
ImplicitParamDecl::Other));
|
||||||
++I;
|
++I;
|
||||||
}
|
}
|
||||||
Args.append(
|
Args.append(
|
||||||
|
|
|
@ -1083,10 +1083,9 @@ QualType CodeGenFunction::BuildFunctionArgList(GlobalDecl GD,
|
||||||
if (!Param->hasAttr<PassObjectSizeAttr>())
|
if (!Param->hasAttr<PassObjectSizeAttr>())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IdentifierInfo *NoID = nullptr;
|
|
||||||
auto *Implicit = ImplicitParamDecl::Create(
|
auto *Implicit = ImplicitParamDecl::Create(
|
||||||
getContext(), Param->getDeclContext(), Param->getLocation(), NoID,
|
getContext(), Param->getDeclContext(), Param->getLocation(),
|
||||||
getContext().getSizeType());
|
/*Id=*/nullptr, getContext().getSizeType(), ImplicitParamDecl::Other);
|
||||||
SizeArguments[Param] = Implicit;
|
SizeArguments[Param] = Implicit;
|
||||||
Args.push_back(Implicit);
|
Args.push_back(Implicit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1408,9 +1408,9 @@ void ItaniumCXXABI::addImplicitStructorParams(CodeGenFunction &CGF,
|
||||||
|
|
||||||
// FIXME: avoid the fake decl
|
// FIXME: avoid the fake decl
|
||||||
QualType T = Context.getPointerType(Context.VoidPtrTy);
|
QualType T = Context.getPointerType(Context.VoidPtrTy);
|
||||||
ImplicitParamDecl *VTTDecl
|
auto *VTTDecl = ImplicitParamDecl::Create(
|
||||||
= ImplicitParamDecl::Create(Context, nullptr, MD->getLocation(),
|
Context, /*DC=*/nullptr, MD->getLocation(), &Context.Idents.get("vtt"),
|
||||||
&Context.Idents.get("vtt"), T);
|
T, ImplicitParamDecl::CXXVTT);
|
||||||
Params.insert(Params.begin() + 1, VTTDecl);
|
Params.insert(Params.begin() + 1, VTTDecl);
|
||||||
getStructorImplicitParamDecl(CGF) = VTTDecl;
|
getStructorImplicitParamDecl(CGF) = VTTDecl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1413,11 +1413,10 @@ void MicrosoftCXXABI::addImplicitStructorParams(CodeGenFunction &CGF,
|
||||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl());
|
const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl());
|
||||||
assert(isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD));
|
assert(isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD));
|
||||||
if (isa<CXXConstructorDecl>(MD) && MD->getParent()->getNumVBases()) {
|
if (isa<CXXConstructorDecl>(MD) && MD->getParent()->getNumVBases()) {
|
||||||
ImplicitParamDecl *IsMostDerived
|
auto *IsMostDerived = ImplicitParamDecl::Create(
|
||||||
= ImplicitParamDecl::Create(Context, nullptr,
|
Context, /*DC=*/nullptr, CGF.CurGD.getDecl()->getLocation(),
|
||||||
CGF.CurGD.getDecl()->getLocation(),
|
&Context.Idents.get("is_most_derived"), Context.IntTy,
|
||||||
&Context.Idents.get("is_most_derived"),
|
ImplicitParamDecl::Other);
|
||||||
Context.IntTy);
|
|
||||||
// The 'most_derived' parameter goes second if the ctor is variadic and last
|
// The 'most_derived' parameter goes second if the ctor is variadic and last
|
||||||
// if it's not. Dtors can't be variadic.
|
// if it's not. Dtors can't be variadic.
|
||||||
const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>();
|
||||||
|
@ -1427,11 +1426,10 @@ void MicrosoftCXXABI::addImplicitStructorParams(CodeGenFunction &CGF,
|
||||||
Params.push_back(IsMostDerived);
|
Params.push_back(IsMostDerived);
|
||||||
getStructorImplicitParamDecl(CGF) = IsMostDerived;
|
getStructorImplicitParamDecl(CGF) = IsMostDerived;
|
||||||
} else if (isDeletingDtor(CGF.CurGD)) {
|
} else if (isDeletingDtor(CGF.CurGD)) {
|
||||||
ImplicitParamDecl *ShouldDelete
|
auto *ShouldDelete = ImplicitParamDecl::Create(
|
||||||
= ImplicitParamDecl::Create(Context, nullptr,
|
Context, /*DC=*/nullptr, CGF.CurGD.getDecl()->getLocation(),
|
||||||
CGF.CurGD.getDecl()->getLocation(),
|
&Context.Idents.get("should_call_delete"), Context.IntTy,
|
||||||
&Context.Idents.get("should_call_delete"),
|
ImplicitParamDecl::Other);
|
||||||
Context.IntTy);
|
|
||||||
Params.push_back(ShouldDelete);
|
Params.push_back(ShouldDelete);
|
||||||
getStructorImplicitParamDecl(CGF) = ShouldDelete;
|
getStructorImplicitParamDecl(CGF) = ShouldDelete;
|
||||||
}
|
}
|
||||||
|
@ -3875,18 +3873,21 @@ MicrosoftCXXABI::getAddrOfCXXCtorClosure(const CXXConstructorDecl *CD,
|
||||||
// Following the 'this' pointer is a reference to the source object that we
|
// Following the 'this' pointer is a reference to the source object that we
|
||||||
// are copying from.
|
// are copying from.
|
||||||
ImplicitParamDecl SrcParam(
|
ImplicitParamDecl SrcParam(
|
||||||
getContext(), nullptr, SourceLocation(), &getContext().Idents.get("src"),
|
getContext(), /*DC=*/nullptr, SourceLocation(),
|
||||||
|
&getContext().Idents.get("src"),
|
||||||
getContext().getLValueReferenceType(RecordTy,
|
getContext().getLValueReferenceType(RecordTy,
|
||||||
/*SpelledAsLValue=*/true));
|
/*SpelledAsLValue=*/true),
|
||||||
|
ImplicitParamDecl::Other);
|
||||||
if (IsCopy)
|
if (IsCopy)
|
||||||
FunctionArgs.push_back(&SrcParam);
|
FunctionArgs.push_back(&SrcParam);
|
||||||
|
|
||||||
// Constructors for classes which utilize virtual bases have an additional
|
// Constructors for classes which utilize virtual bases have an additional
|
||||||
// parameter which indicates whether or not it is being delegated to by a more
|
// parameter which indicates whether or not it is being delegated to by a more
|
||||||
// derived constructor.
|
// derived constructor.
|
||||||
ImplicitParamDecl IsMostDerived(getContext(), nullptr, SourceLocation(),
|
ImplicitParamDecl IsMostDerived(getContext(), /*DC=*/nullptr,
|
||||||
|
SourceLocation(),
|
||||||
&getContext().Idents.get("is_most_derived"),
|
&getContext().Idents.get("is_most_derived"),
|
||||||
getContext().IntTy);
|
getContext().IntTy, ImplicitParamDecl::Other);
|
||||||
// Only add the parameter to the list if thie class has virtual bases.
|
// Only add the parameter to the list if thie class has virtual bases.
|
||||||
if (RD->getNumVBases() > 0)
|
if (RD->getNumVBases() > 0)
|
||||||
FunctionArgs.push_back(&IsMostDerived);
|
FunctionArgs.push_back(&IsMostDerived);
|
||||||
|
|
|
@ -3956,8 +3956,9 @@ void Sema::ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
|
||||||
DeclContext *DC = CapturedDecl::castToDeclContext(CD);
|
DeclContext *DC = CapturedDecl::castToDeclContext(CD);
|
||||||
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
||||||
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
||||||
ImplicitParamDecl *Param
|
auto *Param =
|
||||||
= ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType);
|
ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType,
|
||||||
|
ImplicitParamDecl::CapturedContext);
|
||||||
DC->addDecl(Param);
|
DC->addDecl(Param);
|
||||||
|
|
||||||
CD->setContextParam(0, Param);
|
CD->setContextParam(0, Param);
|
||||||
|
@ -3992,15 +3993,17 @@ void Sema::ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
|
||||||
"null type has been found already for '__context' parameter");
|
"null type has been found already for '__context' parameter");
|
||||||
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
||||||
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
||||||
ImplicitParamDecl *Param
|
auto *Param =
|
||||||
= ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType);
|
ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType,
|
||||||
|
ImplicitParamDecl::CapturedContext);
|
||||||
DC->addDecl(Param);
|
DC->addDecl(Param);
|
||||||
CD->setContextParam(ParamNum, Param);
|
CD->setContextParam(ParamNum, Param);
|
||||||
ContextIsFound = true;
|
ContextIsFound = true;
|
||||||
} else {
|
} else {
|
||||||
IdentifierInfo *ParamName = &Context.Idents.get(I->first);
|
IdentifierInfo *ParamName = &Context.Idents.get(I->first);
|
||||||
ImplicitParamDecl *Param
|
auto *Param =
|
||||||
= ImplicitParamDecl::Create(Context, DC, Loc, ParamName, I->second);
|
ImplicitParamDecl::Create(Context, DC, Loc, ParamName, I->second,
|
||||||
|
ImplicitParamDecl::CapturedContext);
|
||||||
DC->addDecl(Param);
|
DC->addDecl(Param);
|
||||||
CD->setParam(ParamNum, Param);
|
CD->setParam(ParamNum, Param);
|
||||||
}
|
}
|
||||||
|
@ -4010,8 +4013,9 @@ void Sema::ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
|
||||||
// Add __context implicitly if it is not specified.
|
// Add __context implicitly if it is not specified.
|
||||||
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
IdentifierInfo *ParamName = &Context.Idents.get("__context");
|
||||||
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
QualType ParamType = Context.getPointerType(Context.getTagDeclType(RD));
|
||||||
ImplicitParamDecl *Param =
|
auto *Param =
|
||||||
ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType);
|
ImplicitParamDecl::Create(Context, DC, Loc, ParamName, ParamType,
|
||||||
|
ImplicitParamDecl::CapturedContext);
|
||||||
DC->addDecl(Param);
|
DC->addDecl(Param);
|
||||||
CD->setContextParam(ParamNum, Param);
|
CD->setContextParam(ParamNum, Param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1229,6 +1229,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
|
||||||
VD->NonParmVarDeclBits.IsConstexpr = Record.readInt();
|
VD->NonParmVarDeclBits.IsConstexpr = Record.readInt();
|
||||||
VD->NonParmVarDeclBits.IsInitCapture = Record.readInt();
|
VD->NonParmVarDeclBits.IsInitCapture = Record.readInt();
|
||||||
VD->NonParmVarDeclBits.PreviousDeclInSameBlockScope = Record.readInt();
|
VD->NonParmVarDeclBits.PreviousDeclInSameBlockScope = Record.readInt();
|
||||||
|
VD->NonParmVarDeclBits.ImplicitParamKind = Record.readInt();
|
||||||
}
|
}
|
||||||
Linkage VarLinkage = Linkage(Record.readInt());
|
Linkage VarLinkage = Linkage(Record.readInt());
|
||||||
VD->setCachedLinkage(VarLinkage);
|
VD->setCachedLinkage(VarLinkage);
|
||||||
|
|
|
@ -915,6 +915,10 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
|
||||||
Record.push_back(D->isConstexpr());
|
Record.push_back(D->isConstexpr());
|
||||||
Record.push_back(D->isInitCapture());
|
Record.push_back(D->isInitCapture());
|
||||||
Record.push_back(D->isPreviousDeclInSameBlockScope());
|
Record.push_back(D->isPreviousDeclInSameBlockScope());
|
||||||
|
if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
|
||||||
|
Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
|
||||||
|
else
|
||||||
|
Record.push_back(0);
|
||||||
}
|
}
|
||||||
Record.push_back(D->getLinkageInternal());
|
Record.push_back(D->getLinkageInternal());
|
||||||
|
|
||||||
|
@ -1989,6 +1993,7 @@ void ASTWriter::WriteDeclAbbrevs() {
|
||||||
Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
|
Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
|
||||||
Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
|
Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
|
||||||
Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
|
Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
|
||||||
|
Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
|
||||||
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
|
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
|
||||||
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local)
|
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local)
|
||||||
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
|
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
|
||||||
|
@ -98,3 +98,8 @@ void dont_capture_global() {
|
||||||
// CHECK-GLOBALS: load i32, i32* @global
|
// CHECK-GLOBALS: load i32, i32* @global
|
||||||
// CHECK-GLOBALS: load i32, i32* @
|
// CHECK-GLOBALS: load i32, i32* @
|
||||||
// CHECK-GLOBALS: load i32, i32* @e
|
// CHECK-GLOBALS: load i32, i32* @e
|
||||||
|
|
||||||
|
// CHECK-GLOBALS-NOT: DIFlagObjectPointer
|
||||||
|
// CHECK-1-NOT: DIFlagObjectPointer
|
||||||
|
// CHECK-2-NOT: DIFlagObjectPointer
|
||||||
|
// CHECK-3-NOT: DIFlagObjectPointer
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t
|
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm %s -o %t -debug-info-kind=limited
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
|
||||||
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3
|
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3
|
||||||
|
@ -194,3 +194,18 @@ inline int test_captured_linkage() {
|
||||||
void call_test_captured_linkage() {
|
void call_test_captured_linkage() {
|
||||||
test_captured_linkage();
|
test_captured_linkage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CHECK-1-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-1-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-2-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-2-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-3-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-3-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-4-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-4-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-5-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-5-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-6-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-6-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
// CHECK-7-DAG: !DILocalVariable(name: "this", {{.*}}, flags: DIFlagArtificial | DIFlagObjectPointer)
|
||||||
|
// CHECK-7-DAG: !DILocalVariable(name: "__context", {{.*}}, flags: DIFlagArtificial)
|
||||||
|
|
Loading…
Reference in New Issue