mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
DebugInfo: Make MDSubprogram::getFunction() return Constant
Change `MDSubprogram::getFunction()` and `MDGlobalVariable::getConstant()` to return a `Constant`. Previously, both returned `ConstantAsMetadata`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -522,7 +522,7 @@ public:
|
|||||||
/// \brief Check if this provides debugging information for the function F.
|
/// \brief Check if this provides debugging information for the function F.
|
||||||
bool describes(const Function *F);
|
bool describes(const Function *F);
|
||||||
|
|
||||||
Function *getFunction() const;
|
Function *getFunction() const { return get()->getFunction(); }
|
||||||
|
|
||||||
void replaceFunction(Function *F) {
|
void replaceFunction(Function *F) {
|
||||||
if (auto *N = get())
|
if (auto *N = get())
|
||||||
@ -689,12 +689,7 @@ public:
|
|||||||
DITypeRef getType() const { return get()->getType(); }
|
DITypeRef getType() const { return get()->getType(); }
|
||||||
|
|
||||||
GlobalVariable *getGlobal() const;
|
GlobalVariable *getGlobal() const;
|
||||||
Constant *getConstant() const {
|
Constant *getConstant() const { return get()->getVariable(); }
|
||||||
if (auto *N = get())
|
|
||||||
if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getVariable()))
|
|
||||||
return C->getValue();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
DIDerivedType getStaticDataMemberDeclaration() const {
|
DIDerivedType getStaticDataMemberDeclaration() const {
|
||||||
return DIDerivedType(get()->getStaticDataMemberDeclaration());
|
return DIDerivedType(get()->getStaticDataMemberDeclaration());
|
||||||
}
|
}
|
||||||
|
@ -1232,13 +1232,14 @@ class MDSubprogram : public MDLocalScope {
|
|||||||
MDSubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
|
MDSubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||||
unsigned ScopeLine, MDTypeRef ContainingType, unsigned Virtuality,
|
unsigned ScopeLine, MDTypeRef ContainingType, unsigned Virtuality,
|
||||||
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
|
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
|
||||||
ConstantAsMetadata *Function, MDTemplateParameterArray TemplateParams,
|
Constant *Function, MDTemplateParameterArray TemplateParams,
|
||||||
MDSubprogram *Declaration, MDLocalVariableArray Variables,
|
MDSubprogram *Declaration, MDLocalVariableArray Variables,
|
||||||
StorageType Storage, bool ShouldCreate = true) {
|
StorageType Storage, bool ShouldCreate = true) {
|
||||||
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
|
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
|
||||||
getCanonicalMDString(Context, LinkageName), File, Line, Type,
|
getCanonicalMDString(Context, LinkageName), File, Line, Type,
|
||||||
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
|
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
|
||||||
Virtuality, VirtualIndex, Flags, IsOptimized, Function,
|
Virtuality, VirtualIndex, Flags, IsOptimized,
|
||||||
|
Function ? ConstantAsMetadata::get(Function) : nullptr,
|
||||||
TemplateParams.get(), Declaration, Variables.get(), Storage,
|
TemplateParams.get(), Declaration, Variables.get(), Storage,
|
||||||
ShouldCreate);
|
ShouldCreate);
|
||||||
}
|
}
|
||||||
@ -1256,8 +1257,8 @@ class MDSubprogram : public MDLocalScope {
|
|||||||
getFile(), getLine(), getType(), isLocalToUnit(),
|
getFile(), getLine(), getType(), isLocalToUnit(),
|
||||||
isDefinition(), getScopeLine(), getContainingType(),
|
isDefinition(), getScopeLine(), getContainingType(),
|
||||||
getVirtuality(), getVirtualIndex(), getFlags(),
|
getVirtuality(), getVirtualIndex(), getFlags(),
|
||||||
isOptimized(), getFunction(), getTemplateParams(),
|
isOptimized(), getFunctionConstant(),
|
||||||
getDeclaration(), getVariables());
|
getTemplateParams(), getDeclaration(), getVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1267,7 +1268,7 @@ public:
|
|||||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||||
MDTypeRef ContainingType, unsigned Virtuality,
|
MDTypeRef ContainingType, unsigned Virtuality,
|
||||||
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
|
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
|
||||||
ConstantAsMetadata *Function = nullptr,
|
Constant *Function = nullptr,
|
||||||
MDTemplateParameterArray TemplateParams = nullptr,
|
MDTemplateParameterArray TemplateParams = nullptr,
|
||||||
MDSubprogram *Declaration = nullptr,
|
MDSubprogram *Declaration = nullptr,
|
||||||
MDLocalVariableArray Variables = nullptr),
|
MDLocalVariableArray Variables = nullptr),
|
||||||
@ -1344,8 +1345,10 @@ public:
|
|||||||
return MDTypeRef(getRawContainingType());
|
return MDTypeRef(getRawContainingType());
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantAsMetadata *getFunction() const {
|
Constant *getFunctionConstant() const {
|
||||||
return cast_or_null<ConstantAsMetadata>(getRawFunction());
|
if (auto *C = cast_or_null<ConstantAsMetadata>(getRawFunction()))
|
||||||
|
return C->getValue();
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
MDTemplateParameterArray getTemplateParams() const {
|
MDTemplateParameterArray getTemplateParams() const {
|
||||||
return cast_or_null<MDTuple>(getRawTemplateParams());
|
return cast_or_null<MDTuple>(getRawTemplateParams());
|
||||||
@ -1365,6 +1368,13 @@ public:
|
|||||||
Metadata *getRawDeclaration() const { return getOperand(9); }
|
Metadata *getRawDeclaration() const { return getOperand(9); }
|
||||||
Metadata *getRawVariables() const { return getOperand(10); }
|
Metadata *getRawVariables() const { return getOperand(10); }
|
||||||
|
|
||||||
|
/// \brief Get a pointer to the function this subprogram describes.
|
||||||
|
///
|
||||||
|
/// This dyn_casts \a getFunctionConstant() to \a Function.
|
||||||
|
///
|
||||||
|
/// FIXME: Should this be looking through bitcasts?
|
||||||
|
Function *getFunction() const;
|
||||||
|
|
||||||
/// \brief Replace the function.
|
/// \brief Replace the function.
|
||||||
///
|
///
|
||||||
/// If \a isUniqued() and not \a isResolved(), this could node will be
|
/// If \a isUniqued() and not \a isResolved(), this could node will be
|
||||||
@ -1710,12 +1720,13 @@ class MDGlobalVariable : public MDVariable {
|
|||||||
static MDGlobalVariable *
|
static MDGlobalVariable *
|
||||||
getImpl(LLVMContext &Context, MDScope *Scope, StringRef Name,
|
getImpl(LLVMContext &Context, MDScope *Scope, StringRef Name,
|
||||||
StringRef LinkageName, MDFile *File, unsigned Line, MDTypeRef Type,
|
StringRef LinkageName, MDFile *File, unsigned Line, MDTypeRef Type,
|
||||||
bool IsLocalToUnit, bool IsDefinition, ConstantAsMetadata *Variable,
|
bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
|
||||||
MDDerivedType *StaticDataMemberDeclaration, StorageType Storage,
|
MDDerivedType *StaticDataMemberDeclaration, StorageType Storage,
|
||||||
bool ShouldCreate = true) {
|
bool ShouldCreate = true) {
|
||||||
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
|
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
|
||||||
getCanonicalMDString(Context, LinkageName), File, Line, Type,
|
getCanonicalMDString(Context, LinkageName), File, Line, Type,
|
||||||
IsLocalToUnit, IsDefinition, Variable,
|
IsLocalToUnit, IsDefinition,
|
||||||
|
Variable ? ConstantAsMetadata::get(Variable) : nullptr,
|
||||||
StaticDataMemberDeclaration, Storage, ShouldCreate);
|
StaticDataMemberDeclaration, Storage, ShouldCreate);
|
||||||
}
|
}
|
||||||
static MDGlobalVariable *
|
static MDGlobalVariable *
|
||||||
@ -1736,8 +1747,7 @@ public:
|
|||||||
DEFINE_MDNODE_GET(MDGlobalVariable,
|
DEFINE_MDNODE_GET(MDGlobalVariable,
|
||||||
(MDScope * Scope, StringRef Name, StringRef LinkageName,
|
(MDScope * Scope, StringRef Name, StringRef LinkageName,
|
||||||
MDFile *File, unsigned Line, MDTypeRef Type,
|
MDFile *File, unsigned Line, MDTypeRef Type,
|
||||||
bool IsLocalToUnit, bool IsDefinition,
|
bool IsLocalToUnit, bool IsDefinition, Constant *Variable,
|
||||||
ConstantAsMetadata *Variable,
|
|
||||||
MDDerivedType *StaticDataMemberDeclaration),
|
MDDerivedType *StaticDataMemberDeclaration),
|
||||||
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
|
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
|
||||||
IsDefinition, Variable, StaticDataMemberDeclaration))
|
IsDefinition, Variable, StaticDataMemberDeclaration))
|
||||||
@ -1755,8 +1765,10 @@ public:
|
|||||||
bool isDefinition() const { return IsDefinition; }
|
bool isDefinition() const { return IsDefinition; }
|
||||||
StringRef getDisplayName() const { return getStringOperand(4); }
|
StringRef getDisplayName() const { return getStringOperand(4); }
|
||||||
StringRef getLinkageName() const { return getStringOperand(5); }
|
StringRef getLinkageName() const { return getStringOperand(5); }
|
||||||
ConstantAsMetadata *getVariable() const {
|
Constant *getVariable() const {
|
||||||
return cast_or_null<ConstantAsMetadata>(getRawVariable());
|
if (auto *C = cast_or_null<ConstantAsMetadata>(getRawVariable()))
|
||||||
|
return dyn_cast<Constant>(C->getValue());
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
MDDerivedType *getStaticDataMemberDeclaration() const {
|
MDDerivedType *getStaticDataMemberDeclaration() const {
|
||||||
return cast_or_null<MDDerivedType>(getRawStaticDataMemberDeclaration());
|
return cast_or_null<MDDerivedType>(getRawStaticDataMemberDeclaration());
|
||||||
|
@ -970,7 +970,7 @@ static void WriteMDSubprogram(const MDSubprogram *N,
|
|||||||
Record.push_back(N->getVirtualIndex());
|
Record.push_back(N->getVirtualIndex());
|
||||||
Record.push_back(N->getFlags());
|
Record.push_back(N->getFlags());
|
||||||
Record.push_back(N->isOptimized());
|
Record.push_back(N->isOptimized());
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getFunction()));
|
Record.push_back(VE.getMetadataOrNullID(N->getRawFunction()));
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams().get()));
|
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams().get()));
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getDeclaration()));
|
Record.push_back(VE.getMetadataOrNullID(N->getDeclaration()));
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getVariables().get()));
|
Record.push_back(VE.getMetadataOrNullID(N->getVariables().get()));
|
||||||
@ -1064,7 +1064,7 @@ static void WriteMDGlobalVariable(const MDGlobalVariable *N,
|
|||||||
Record.push_back(VE.getMetadataOrNullID(N->getType()));
|
Record.push_back(VE.getMetadataOrNullID(N->getType()));
|
||||||
Record.push_back(N->isLocalToUnit());
|
Record.push_back(N->isLocalToUnit());
|
||||||
Record.push_back(N->isDefinition());
|
Record.push_back(N->isDefinition());
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getVariable()));
|
Record.push_back(VE.getMetadataOrNullID(N->getRawVariable()));
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
|
Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
|
||||||
|
|
||||||
Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);
|
Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);
|
||||||
|
@ -594,8 +594,8 @@ DIGlobalVariable DIBuilder::createGlobalVariable(
|
|||||||
|
|
||||||
auto *N = MDGlobalVariable::get(
|
auto *N = MDGlobalVariable::get(
|
||||||
VMContext, cast_or_null<MDScope>(Context.get()), Name, LinkageName, F,
|
VMContext, cast_or_null<MDScope>(Context.get()), Name, LinkageName, F,
|
||||||
LineNumber, MDTypeRef::get(Ty), isLocalToUnit, true,
|
LineNumber, MDTypeRef::get(Ty), isLocalToUnit, true, Val,
|
||||||
getConstantOrNull(Val), cast_or_null<MDDerivedType>(Decl));
|
cast_or_null<MDDerivedType>(Decl));
|
||||||
AllGVs.push_back(N);
|
AllGVs.push_back(N);
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ DIGlobalVariable DIBuilder::createTempGlobalVariableFwdDecl(
|
|||||||
|
|
||||||
return MDGlobalVariable::getTemporary(
|
return MDGlobalVariable::getTemporary(
|
||||||
VMContext, cast_or_null<MDScope>(Context.get()), Name, LinkageName,
|
VMContext, cast_or_null<MDScope>(Context.get()), Name, LinkageName,
|
||||||
F, LineNumber, MDTypeRef::get(Ty), isLocalToUnit, false, getConstantOrNull(Val),
|
F, LineNumber, MDTypeRef::get(Ty), isLocalToUnit, false, Val,
|
||||||
cast_or_null<MDDerivedType>(Decl)).release();
|
cast_or_null<MDDerivedType>(Decl)).release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
|
|||||||
VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))),
|
VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))),
|
||||||
Name, LinkageName, File.get(), LineNo,
|
Name, LinkageName, File.get(), LineNo,
|
||||||
cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, isDefinition,
|
cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, isDefinition,
|
||||||
ScopeLine, nullptr, 0, 0, Flags, isOptimized, getConstantOrNull(Fn),
|
ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
|
||||||
cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
|
cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
|
||||||
MDTuple::getTemporary(VMContext, None).release());
|
MDTuple::getTemporary(VMContext, None).release());
|
||||||
|
|
||||||
@ -704,10 +704,9 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name,
|
|||||||
MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), Name,
|
MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), Name,
|
||||||
LinkageName, File.get(), LineNo,
|
LinkageName, File.get(), LineNo,
|
||||||
cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
|
cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
|
||||||
isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
|
isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
|
||||||
getConstantOrNull(Fn), cast_or_null<MDTuple>(TParams),
|
cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
|
||||||
cast_or_null<MDSubprogram>(Decl), nullptr)
|
nullptr).release();
|
||||||
.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
|
DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
|
||||||
@ -728,8 +727,7 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
|
|||||||
VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName,
|
VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName,
|
||||||
F.get(), LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
|
F.get(), LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
|
||||||
isDefinition, LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags,
|
isDefinition, LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags,
|
||||||
isOptimized, getConstantOrNull(Fn), cast_or_null<MDTuple>(TParam),
|
isOptimized, Fn, cast_or_null<MDTuple>(TParam), nullptr, nullptr);
|
||||||
nullptr, nullptr);
|
|
||||||
|
|
||||||
if (isDefinition)
|
if (isDefinition)
|
||||||
AllSubprograms.push_back(SP);
|
AllSubprograms.push_back(SP);
|
||||||
|
@ -49,12 +49,6 @@ bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
|
|||||||
return !SP.describes(CurFn);
|
return !SP.describes(CurFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function *DISubprogram::getFunction() const {
|
|
||||||
if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(get()->getFunction()))
|
|
||||||
return dyn_cast<Function>(C->getValue());
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DISubprogram::describes(const Function *F) {
|
bool DISubprogram::describes(const Function *F) {
|
||||||
assert(F && "Invalid function");
|
assert(F && "Invalid function");
|
||||||
if (F == getFunction())
|
if (F == getFunction())
|
||||||
|
@ -343,6 +343,11 @@ MDSubprogram *MDSubprogram::getImpl(
|
|||||||
Ops);
|
Ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function *MDSubprogram::getFunction() const {
|
||||||
|
// FIXME: Should this be looking through bitcasts?
|
||||||
|
return dyn_cast_or_null<Function>(getFunctionConstant());
|
||||||
|
}
|
||||||
|
|
||||||
void MDSubprogram::replaceFunction(Function *F) {
|
void MDSubprogram::replaceFunction(Function *F) {
|
||||||
replaceFunction(F ? ConstantAsMetadata::get(F)
|
replaceFunction(F ? ConstantAsMetadata::get(F)
|
||||||
: static_cast<ConstantAsMetadata *>(nullptr));
|
: static_cast<ConstantAsMetadata *>(nullptr));
|
||||||
|
@ -964,11 +964,7 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
|
|||||||
Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
|
Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
|
||||||
&N);
|
&N);
|
||||||
|
|
||||||
if (!N.getFunction())
|
auto *F = N.getFunction();
|
||||||
return;
|
|
||||||
|
|
||||||
// FIXME: Should this be looking through bitcasts?
|
|
||||||
auto *F = dyn_cast<Function>(N.getFunction()->getValue());
|
|
||||||
if (!F)
|
if (!F)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -99,9 +99,11 @@ protected:
|
|||||||
getBasicType("basictype"), 1, 2, 0, 0)
|
getBasicType("basictype"), 1, 2, 0, 0)
|
||||||
->getRef();
|
->getRef();
|
||||||
}
|
}
|
||||||
|
Constant *getConstant() {
|
||||||
|
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
||||||
|
}
|
||||||
ConstantAsMetadata *getConstantAsMetadata() {
|
ConstantAsMetadata *getConstantAsMetadata() {
|
||||||
return ConstantAsMetadata::get(
|
return ConstantAsMetadata::get(getConstant());
|
||||||
ConstantInt::get(Type::getInt32Ty(Context), Counter++));
|
|
||||||
}
|
}
|
||||||
MDTypeRef getCompositeType() {
|
MDTypeRef getCompositeType() {
|
||||||
return MDCompositeType::getDistinct(
|
return MDCompositeType::getDistinct(
|
||||||
@ -109,8 +111,8 @@ protected:
|
|||||||
nullptr, 32, 32, 0, 0, nullptr, 0, nullptr, nullptr, "")
|
nullptr, 32, 32, 0, 0, nullptr, 0, nullptr, nullptr, "")
|
||||||
->getRef();
|
->getRef();
|
||||||
}
|
}
|
||||||
ConstantAsMetadata *getFunctionAsMetadata(StringRef Name) {
|
Function *getFunction(StringRef Name) {
|
||||||
return ConstantAsMetadata::get(M.getOrInsertFunction(
|
return cast<Function>(M.getOrInsertFunction(
|
||||||
Name, FunctionType::get(Type::getVoidTy(Context), None, false)));
|
Name, FunctionType::get(Type::getVoidTy(Context), None, false)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1431,7 +1433,7 @@ TEST_F(MDSubprogramTest, get) {
|
|||||||
unsigned VirtualIndex = 5;
|
unsigned VirtualIndex = 5;
|
||||||
unsigned Flags = 6;
|
unsigned Flags = 6;
|
||||||
bool IsOptimized = false;
|
bool IsOptimized = false;
|
||||||
ConstantAsMetadata *Function = getFunctionAsMetadata("foo");
|
llvm::Function *Function = getFunction("foo");
|
||||||
MDTuple *TemplateParams = getTuple();
|
MDTuple *TemplateParams = getTuple();
|
||||||
MDSubprogram *Declaration = getSubprogram();
|
MDSubprogram *Declaration = getSubprogram();
|
||||||
MDTuple *Variables = getTuple();
|
MDTuple *Variables = getTuple();
|
||||||
@ -1536,12 +1538,11 @@ TEST_F(MDSubprogramTest, get) {
|
|||||||
ContainingType, Virtuality, VirtualIndex,
|
ContainingType, Virtuality, VirtualIndex,
|
||||||
Flags, !IsOptimized, Function, TemplateParams,
|
Flags, !IsOptimized, Function, TemplateParams,
|
||||||
Declaration, Variables));
|
Declaration, Variables));
|
||||||
EXPECT_NE(N,
|
EXPECT_NE(N, MDSubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
||||||
MDSubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
||||||
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
ContainingType, Virtuality, VirtualIndex,
|
||||||
ContainingType, Virtuality, VirtualIndex, Flags,
|
Flags, IsOptimized, getFunction("bar"),
|
||||||
IsOptimized, getFunctionAsMetadata("bar"),
|
TemplateParams, Declaration, Variables));
|
||||||
TemplateParams, Declaration, Variables));
|
|
||||||
EXPECT_NE(N, MDSubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
EXPECT_NE(N, MDSubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
||||||
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
||||||
ContainingType, Virtuality, VirtualIndex,
|
ContainingType, Virtuality, VirtualIndex,
|
||||||
@ -1592,7 +1593,7 @@ TEST_F(MDSubprogramTest, replaceFunction) {
|
|||||||
Function::Create(FunctionType::get(Type::getVoidTy(Context), false),
|
Function::Create(FunctionType::get(Type::getVoidTy(Context), false),
|
||||||
GlobalValue::ExternalLinkage));
|
GlobalValue::ExternalLinkage));
|
||||||
N->replaceFunction(F.get());
|
N->replaceFunction(F.get());
|
||||||
EXPECT_EQ(ConstantAsMetadata::get(F.get()), N->getFunction());
|
EXPECT_EQ(F.get(), N->getFunction());
|
||||||
|
|
||||||
N->replaceFunction(nullptr);
|
N->replaceFunction(nullptr);
|
||||||
EXPECT_EQ(nullptr, N->getFunction());
|
EXPECT_EQ(nullptr, N->getFunction());
|
||||||
@ -1738,7 +1739,7 @@ TEST_F(MDGlobalVariableTest, get) {
|
|||||||
MDTypeRef Type = getDerivedType();
|
MDTypeRef Type = getDerivedType();
|
||||||
bool IsLocalToUnit = false;
|
bool IsLocalToUnit = false;
|
||||||
bool IsDefinition = true;
|
bool IsDefinition = true;
|
||||||
ConstantAsMetadata *Variable = getConstantAsMetadata();
|
Constant *Variable = getConstant();
|
||||||
MDDerivedType *StaticDataMemberDeclaration =
|
MDDerivedType *StaticDataMemberDeclaration =
|
||||||
cast<MDDerivedType>(getDerivedType());
|
cast<MDDerivedType>(getDerivedType());
|
||||||
|
|
||||||
@ -1788,10 +1789,10 @@ TEST_F(MDGlobalVariableTest, get) {
|
|||||||
EXPECT_NE(N, MDGlobalVariable::get(Context, Scope, Name, LinkageName, File,
|
EXPECT_NE(N, MDGlobalVariable::get(Context, Scope, Name, LinkageName, File,
|
||||||
Line, Type, IsLocalToUnit, !IsDefinition,
|
Line, Type, IsLocalToUnit, !IsDefinition,
|
||||||
Variable, StaticDataMemberDeclaration));
|
Variable, StaticDataMemberDeclaration));
|
||||||
EXPECT_NE(N, MDGlobalVariable::get(Context, Scope, Name, LinkageName, File,
|
EXPECT_NE(N,
|
||||||
Line, Type, IsLocalToUnit, IsDefinition,
|
MDGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
|
||||||
getConstantAsMetadata(),
|
Type, IsLocalToUnit, IsDefinition,
|
||||||
StaticDataMemberDeclaration));
|
getConstant(), StaticDataMemberDeclaration));
|
||||||
EXPECT_NE(N,
|
EXPECT_NE(N,
|
||||||
MDGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
|
MDGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
|
||||||
Type, IsLocalToUnit, IsDefinition, Variable,
|
Type, IsLocalToUnit, IsDefinition, Variable,
|
||||||
|
Reference in New Issue
Block a user