IR: Remove MDTupleTypedArrayWrapper::operator MDTuple*()

Remove `MDTupleTypedArrayWrapper::operator MDTuple*()`, since it causes
ambiguity (at least in some [1] compilers [2]) when using indexes to
`MDTupleTypedArrayWrapper::operator[](unsigned)` that are convertible to
(but not the same as) `unsigned`.

[1]: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2308
[2]: http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/4442

llvm-svn: 234326
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-07 16:50:39 +00:00
parent 1ed7bf573d
commit 14d896c4af
9 changed files with 128 additions and 89 deletions

View File

@ -205,7 +205,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
Metadata **DataValue = unwrap(Data);
ArrayRef<Metadata *> Elements(DataValue, Length);
DIArray A = D->getOrCreateArray(Elements);
return wrap(A);
return wrap(A.get());
}
LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
@ -215,7 +215,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
Metadata **DataValue = unwrap(Data);
ArrayRef<Metadata *> Elements(DataValue, Length);
DITypeArray A = D->getOrCreateTypeArray(Elements);
return wrap(A);
return wrap(A.get());
}
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,

View File

@ -439,9 +439,7 @@ public:
return DITypeRef::get(get()->getVTableHolder());
}
DIArray getTemplateParams() const {
return DIArray(get()->getTemplateParams());
}
DIArray getTemplateParams() const { return get()->getTemplateParams(); }
MDString *getIdentifier() const { return get()->getRawIdentifier(); }
};
@ -585,7 +583,6 @@ public:
DISubprogram getFunctionDeclaration() const {
return DISubprogram(get()->getDeclaration());
}
MDNode *getVariablesNodes() const { return getVariables(); }
DIArray getVariables() const { return DIArray(get()->getVariables()); }
unsigned isArtificial() const { return get()->isArtificial(); }

View File

@ -97,9 +97,13 @@ class MDTypeRefArray {
public:
MDTypeRefArray(const MDTuple *N) : N(N) {}
operator MDTuple *() const { return const_cast<MDTuple *>(N); }
MDTuple *operator->() const { return const_cast<MDTuple *>(N); }
MDTuple &operator*() const { return *const_cast<MDTuple *>(N); }
explicit operator bool() const { return get(); }
explicit operator MDTuple *() const { return get(); }
MDTuple *get() const { return const_cast<MDTuple *>(N); }
MDTuple *operator->() const { return get(); }
MDTuple &operator*() const { return *get(); }
// FIXME: Fix callers and remove condition on N.
unsigned size() const { return N ? N->getNumOperands() : 0u; }
@ -746,7 +750,7 @@ protected:
~MDCompositeTypeBase() {}
public:
MDTuple *getElements() const {
DebugNodeArray getElements() const {
return cast_or_null<MDTuple>(getRawElements());
}
MDTypeRef getVTableHolder() const { return MDTypeRef(getRawVTableHolder()); }
@ -767,20 +771,19 @@ public:
/// this will be RAUW'ed and deleted. Use a \a TrackingMDRef to keep track
/// of its movement if necessary.
/// @{
void replaceElements(MDTuple *Elements) {
void replaceElements(DebugNodeArray Elements) {
#ifndef NDEBUG
if (auto *Old = cast_or_null<MDTuple>(getElements()))
for (const auto &Op : Old->operands())
assert(std::find(Elements->op_begin(), Elements->op_end(), Op) &&
"Lost a member during member list replacement");
for (DebugNode *Op : getElements())
assert(std::find(Elements->op_begin(), Elements->op_end(), Op) &&
"Lost a member during member list replacement");
#endif
replaceOperandWith(4, Elements);
replaceOperandWith(4, Elements.get());
}
void replaceVTableHolder(MDTypeRef VTableHolder) {
replaceOperandWith(5, VTableHolder);
}
void replaceTemplateParams(MDTemplateParameterArray TemplateParams) {
replaceOperandWith(6, TemplateParams);
replaceOperandWith(6, TemplateParams.get());
}
/// @}
@ -811,14 +814,14 @@ class MDCompositeType : public MDCompositeTypeBase {
getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
unsigned Line, MDScopeRef Scope, MDTypeRef BaseType,
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
uint64_t Flags, MDTuple *Elements, unsigned RuntimeLang,
uint64_t Flags, DebugNodeArray Elements, unsigned RuntimeLang,
MDTypeRef VTableHolder, MDTemplateParameterArray TemplateParams,
StringRef Identifier, StorageType Storage, bool ShouldCreate = true) {
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits,
Flags, Elements, RuntimeLang, VTableHolder, TemplateParams,
getCanonicalMDString(Context, Identifier), Storage,
ShouldCreate);
return getImpl(
Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope,
BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements.get(),
RuntimeLang, VTableHolder, TemplateParams.get(),
getCanonicalMDString(Context, Identifier), Storage, ShouldCreate);
}
static MDCompositeType *
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
@ -841,8 +844,8 @@ public:
(unsigned Tag, StringRef Name, MDFile *File, unsigned Line,
MDScopeRef Scope, MDTypeRef BaseType, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, MDTuple *Elements, unsigned RuntimeLang,
MDTypeRef VTableHolder,
unsigned Flags, DebugNodeArray Elements,
unsigned RuntimeLang, MDTypeRef VTableHolder,
MDTemplateParameterArray TemplateParams = nullptr,
StringRef Identifier = ""),
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
@ -890,6 +893,12 @@ class MDSubroutineType : public MDCompositeTypeBase {
Ops) {}
~MDSubroutineType() {}
static MDSubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
MDTypeRefArray TypeArray,
StorageType Storage,
bool ShouldCreate = true) {
return getImpl(Context, Flags, TypeArray.get(), Storage, ShouldCreate);
}
static MDSubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
Metadata *TypeArray, StorageType Storage,
bool ShouldCreate = true);
@ -899,12 +908,17 @@ class MDSubroutineType : public MDCompositeTypeBase {
}
public:
DEFINE_MDNODE_GET(MDSubroutineType,
(unsigned Flags, MDTypeRefArray TypeArray),
(Flags, TypeArray))
DEFINE_MDNODE_GET(MDSubroutineType, (unsigned Flags, Metadata *TypeArray),
(Flags, TypeArray))
TempMDSubroutineType clone() const { return cloneImpl(); }
MDTypeRefArray getTypeArray() const { return getElements(); }
MDTypeRefArray getTypeArray() const {
return cast_or_null<MDTuple>(getRawTypeArray());
}
Metadata *getRawTypeArray() const { return getRawElements(); }
static bool classof(const Metadata *MD) {
@ -934,16 +948,17 @@ class MDCompileUnit : public MDScope {
getImpl(LLVMContext &Context, unsigned SourceLanguage, MDFile *File,
StringRef Producer, bool IsOptimized, StringRef Flags,
unsigned RuntimeVersion, StringRef SplitDebugFilename,
unsigned EmissionKind, MDTuple *EnumTypes, MDTuple *RetainedTypes,
MDTuple *Subprograms, MDTuple *GlobalVariables,
MDTuple *ImportedEntities, StorageType Storage,
unsigned EmissionKind, MDCompositeTypeArray EnumTypes,
MDTypeArray RetainedTypes, MDSubprogramArray Subprograms,
MDGlobalVariableArray GlobalVariables,
MDImportedEntityArray ImportedEntities, StorageType Storage,
bool ShouldCreate = true) {
return getImpl(Context, SourceLanguage, File,
getCanonicalMDString(Context, Producer), IsOptimized,
getCanonicalMDString(Context, Flags), RuntimeVersion,
getCanonicalMDString(Context, SplitDebugFilename),
EmissionKind, EnumTypes, RetainedTypes, Subprograms,
GlobalVariables, ImportedEntities, Storage, ShouldCreate);
return getImpl(
Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion,
getCanonicalMDString(Context, SplitDebugFilename), EmissionKind,
EnumTypes.get(), RetainedTypes.get(), Subprograms.get(),
GlobalVariables.get(), ImportedEntities.get(), Storage, ShouldCreate);
}
static MDCompileUnit *
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
@ -967,9 +982,10 @@ public:
(unsigned SourceLanguage, MDFile *File, StringRef Producer,
bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
StringRef SplitDebugFilename, unsigned EmissionKind,
MDTuple *EnumTypes, MDTuple *RetainedTypes,
MDTuple *Subprograms, MDTuple *GlobalVariables,
MDTuple *ImportedEntities),
MDCompositeTypeArray EnumTypes, MDTypeArray RetainedTypes,
MDSubprogramArray Subprograms,
MDGlobalVariableArray GlobalVariables,
MDImportedEntityArray ImportedEntities),
(SourceLanguage, File, Producer, IsOptimized, Flags,
RuntimeVersion, SplitDebugFilename, EmissionKind,
EnumTypes, RetainedTypes, Subprograms, GlobalVariables,
@ -1028,8 +1044,12 @@ public:
/// deleted on a uniquing collision. In practice, uniquing collisions on \a
/// MDCompileUnit should be fairly rare.
/// @{
void replaceSubprograms(MDTuple *N) { replaceOperandWith(6, N); }
void replaceGlobalVariables(MDTuple *N) { replaceOperandWith(7, N); }
void replaceSubprograms(MDSubprogramArray N) {
replaceOperandWith(6, N.get());
}
void replaceGlobalVariables(MDGlobalVariableArray N) {
replaceOperandWith(7, N.get());
}
/// @}
static bool classof(const Metadata *MD) {
@ -1179,7 +1199,7 @@ class MDSubprogram : public MDLocalScope {
getCanonicalMDString(Context, LinkageName), File, Line, Type,
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
Virtuality, VirtualIndex, Flags, IsOptimized, Function,
TemplateParams, Declaration, Variables, Storage,
TemplateParams.get(), Declaration, Variables.get(), Storage,
ShouldCreate);
}
static MDSubprogram *

View File

@ -1069,9 +1069,27 @@ template <class T> class MDTupleTypedArrayWrapper {
public:
MDTupleTypedArrayWrapper() = default;
MDTupleTypedArrayWrapper(const MDTuple *N) : N(N) {}
operator MDTuple *() const { return const_cast<MDTuple *>(N); }
MDTuple *operator->() const { return const_cast<MDTuple *>(N); }
MDTuple &operator*() const { return *const_cast<MDTuple *>(N); }
template <class U>
MDTupleTypedArrayWrapper(
const MDTupleTypedArrayWrapper<U> &Other,
typename std::enable_if<std::is_convertible<U *, T *>::value>::type * =
nullptr)
: N(Other.get()) {}
template <class U>
explicit MDTupleTypedArrayWrapper(
const U &Tuple,
typename std::enable_if<
std::is_constructible<const MDTuple *, U>::value>::type * = nullptr)
: N(Tuple) {}
explicit operator bool() const { return get(); }
explicit operator MDTuple *() const { return get(); }
MDTuple *get() const { return const_cast<MDTuple *>(N); }
MDTuple *operator->() const { return get(); }
MDTuple &operator*() const { return *get(); }
// FIXME: Fix callers and remove condition on N.
unsigned size() const { return N ? N->getNumOperands() : 0u; }

View File

@ -892,10 +892,10 @@ static void WriteMDCompositeType(const MDCompositeType *N,
Record.push_back(N->getAlignInBits());
Record.push_back(N->getOffsetInBits());
Record.push_back(N->getFlags());
Record.push_back(VE.getMetadataOrNullID(N->getElements()));
Record.push_back(VE.getMetadataOrNullID(N->getElements().get()));
Record.push_back(N->getRuntimeLang());
Record.push_back(VE.getMetadataOrNullID(N->getVTableHolder()));
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams()));
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams().get()));
Record.push_back(VE.getMetadataOrNullID(N->getRawIdentifier()));
Stream.EmitRecord(bitc::METADATA_COMPOSITE_TYPE, Record, Abbrev);
@ -909,7 +909,7 @@ static void WriteMDSubroutineType(const MDSubroutineType *N,
unsigned Abbrev) {
Record.push_back(N->isDistinct());
Record.push_back(N->getFlags());
Record.push_back(VE.getMetadataOrNullID(N->getTypeArray()));
Record.push_back(VE.getMetadataOrNullID(N->getTypeArray().get()));
Stream.EmitRecord(bitc::METADATA_SUBROUTINE_TYPE, Record, Abbrev);
Record.clear();
@ -940,11 +940,11 @@ static void WriteMDCompileUnit(const MDCompileUnit *N,
Record.push_back(N->getRuntimeVersion());
Record.push_back(VE.getMetadataOrNullID(N->getRawSplitDebugFilename()));
Record.push_back(N->getEmissionKind());
Record.push_back(VE.getMetadataOrNullID(N->getEnumTypes()));
Record.push_back(VE.getMetadataOrNullID(N->getRetainedTypes()));
Record.push_back(VE.getMetadataOrNullID(N->getSubprograms()));
Record.push_back(VE.getMetadataOrNullID(N->getGlobalVariables()));
Record.push_back(VE.getMetadataOrNullID(N->getImportedEntities()));
Record.push_back(VE.getMetadataOrNullID(N->getEnumTypes().get()));
Record.push_back(VE.getMetadataOrNullID(N->getRetainedTypes().get()));
Record.push_back(VE.getMetadataOrNullID(N->getSubprograms().get()));
Record.push_back(VE.getMetadataOrNullID(N->getGlobalVariables().get()));
Record.push_back(VE.getMetadataOrNullID(N->getImportedEntities().get()));
Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);
Record.clear();
@ -971,9 +971,9 @@ static void WriteMDSubprogram(const MDSubprogram *N,
Record.push_back(N->getFlags());
Record.push_back(N->isOptimized());
Record.push_back(VE.getMetadataOrNullID(N->getFunction()));
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams()));
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams().get()));
Record.push_back(VE.getMetadataOrNullID(N->getDeclaration()));
Record.push_back(VE.getMetadataOrNullID(N->getVariables()));
Record.push_back(VE.getMetadataOrNullID(N->getVariables().get()));
Stream.EmitRecord(bitc::METADATA_SUBPROGRAM, Record, Abbrev);
Record.clear();

View File

@ -75,7 +75,7 @@ void DIBuilder::trackIfUnresolved(MDNode *N) {
void DIBuilder::finalize() {
DIArray Enums = getOrCreateArray(AllEnumTypes);
TempEnumTypes->replaceAllUsesWith(Enums);
TempEnumTypes->replaceAllUsesWith(Enums.get());
SmallVector<Metadata *, 16> RetainValues;
// Declarations and definitions of the same type may be retained. Some
@ -87,27 +87,27 @@ void DIBuilder::finalize() {
if (RetainSet.insert(AllRetainTypes[I]).second)
RetainValues.push_back(AllRetainTypes[I]);
DIArray RetainTypes = getOrCreateArray(RetainValues);
TempRetainTypes->replaceAllUsesWith(RetainTypes);
TempRetainTypes->replaceAllUsesWith(RetainTypes.get());
DIArray SPs = getOrCreateArray(AllSubprograms);
TempSubprograms->replaceAllUsesWith(SPs);
TempSubprograms->replaceAllUsesWith(SPs.get());
for (unsigned i = 0, e = SPs.size(); i != e; ++i) {
DISubprogram SP = cast<MDSubprogram>(SPs[i]);
if (MDNode *Temp = SP.getVariablesNodes()) {
if (MDNode *Temp = SP.getVariables().get()) {
const auto &PV = PreservedVariables.lookup(SP);
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
DIArray AV = getOrCreateArray(Variables);
Temp->replaceAllUsesWith(AV);
Temp->replaceAllUsesWith(AV.get());
}
}
DIArray GVs = getOrCreateArray(AllGVs);
TempGVs->replaceAllUsesWith(GVs);
TempGVs->replaceAllUsesWith(GVs.get());
SmallVector<Metadata *, 16> RetainValuesI(AllImportedModules.begin(),
AllImportedModules.end());
DIArray IMs = getOrCreateArray(RetainValuesI);
TempImportedModules->replaceAllUsesWith(IMs);
TempImportedModules->replaceAllUsesWith(IMs.get());
// Now that all temp nodes have been replaced or deleted, resolve remaining
// cycles.
@ -383,7 +383,7 @@ DIBuilder::createTemplateParameterPack(DIDescriptor Context, StringRef Name,
DIType Ty, DIArray Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
Val);
Val.get());
}
DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
@ -872,7 +872,7 @@ void DIBuilder::replaceArrays(DICompositeType &T, DIArray Elements,
// arrays explicitly if they're unresolved, or else the cycles will be
// orphaned.
if (Elements)
trackIfUnresolved(Elements);
trackIfUnresolved(Elements.get());
if (TParams)
trackIfUnresolved(TParams);
trackIfUnresolved(TParams.get());
}

View File

@ -206,11 +206,11 @@ StringRef DIScope::getDirectory() const {
}
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
get()->replaceSubprograms(Subprograms);
get()->replaceSubprograms(MDSubprogramArray(Subprograms));
}
void DICompileUnit::replaceGlobalVariables(DIArray GlobalVariables) {
get()->replaceGlobalVariables(GlobalVariables);
get()->replaceGlobalVariables(MDGlobalVariableArray(GlobalVariables));
}
DILocation DILocation::copyWithNewScope(LLVMContext &Ctx,

View File

@ -110,6 +110,10 @@ private:
OS << '\n';
}
template <class T> void Write(const MDTupleTypedArrayWrapper<T> &MD) {
Write(MD.get());
}
void Write(const NamedMDNode *NMD) {
if (!NMD)
return;

View File

@ -1068,10 +1068,10 @@ TEST_F(MDCompositeTypeTest, get) {
EXPECT_EQ(AlignInBits, N->getAlignInBits());
EXPECT_EQ(OffsetInBits, N->getOffsetInBits());
EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(Elements, N->getElements());
EXPECT_EQ(Elements, N->getElements().get());
EXPECT_EQ(RuntimeLang, N->getRuntimeLang());
EXPECT_EQ(VTableHolder, N->getVTableHolder());
EXPECT_EQ(TemplateParams, N->getTemplateParams());
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
EXPECT_EQ(Identifier, N->getIdentifier());
EXPECT_EQ(N, MDCompositeType::get(Context, Tag, Name, File, Line, Scope,
@ -1200,11 +1200,11 @@ TEST_F(MDCompositeTypeTest, replaceOperands) {
nullptr, nullptr, Identifier);
auto *Elements = MDTuple::getDistinct(Context, None);
EXPECT_EQ(nullptr, N->getElements());
EXPECT_EQ(nullptr, N->getElements().get());
N->replaceElements(Elements);
EXPECT_EQ(Elements, N->getElements());
EXPECT_EQ(Elements, N->getElements().get());
N->replaceElements(nullptr);
EXPECT_EQ(nullptr, N->getElements());
EXPECT_EQ(nullptr, N->getElements().get());
MDTypeRef VTableHolder = getCompositeType();
EXPECT_EQ(nullptr, N->getVTableHolder());
@ -1214,11 +1214,11 @@ TEST_F(MDCompositeTypeTest, replaceOperands) {
EXPECT_EQ(nullptr, N->getVTableHolder());
auto *TemplateParams = MDTuple::getDistinct(Context, None);
EXPECT_EQ(nullptr, N->getTemplateParams());
EXPECT_EQ(nullptr, N->getTemplateParams().get());
N->replaceTemplateParams(TemplateParams);
EXPECT_EQ(TemplateParams, N->getTemplateParams());
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
N->replaceTemplateParams(nullptr);
EXPECT_EQ(nullptr, N->getTemplateParams());
EXPECT_EQ(nullptr, N->getTemplateParams().get());
}
typedef MetadataTest MDSubroutineTypeTest;
@ -1230,7 +1230,7 @@ TEST_F(MDSubroutineTypeTest, get) {
auto *N = MDSubroutineType::get(Context, Flags, TypeArray);
EXPECT_EQ(dwarf::DW_TAG_subroutine_type, N->getTag());
EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(TypeArray, N->getTypeArray());
EXPECT_EQ(TypeArray, N->getTypeArray().get());
EXPECT_EQ(N, MDSubroutineType::get(Context, Flags, TypeArray));
EXPECT_NE(N, MDSubroutineType::get(Context, Flags + 1, TypeArray));
@ -1245,7 +1245,7 @@ TEST_F(MDSubroutineTypeTest, get) {
EXPECT_EQ("", N->getName());
EXPECT_EQ(nullptr, N->getBaseType());
EXPECT_EQ(nullptr, N->getVTableHolder());
EXPECT_EQ(nullptr, N->getTemplateParams());
EXPECT_EQ(nullptr, N->getTemplateParams().get());
EXPECT_EQ("", N->getIdentifier());
}
@ -1304,11 +1304,11 @@ TEST_F(MDCompileUnitTest, get) {
EXPECT_EQ(RuntimeVersion, N->getRuntimeVersion());
EXPECT_EQ(SplitDebugFilename, N->getSplitDebugFilename());
EXPECT_EQ(EmissionKind, N->getEmissionKind());
EXPECT_EQ(EnumTypes, N->getEnumTypes());
EXPECT_EQ(RetainedTypes, N->getRetainedTypes());
EXPECT_EQ(Subprograms, N->getSubprograms());
EXPECT_EQ(GlobalVariables, N->getGlobalVariables());
EXPECT_EQ(ImportedEntities, N->getImportedEntities());
EXPECT_EQ(EnumTypes, N->getEnumTypes().get());
EXPECT_EQ(RetainedTypes, N->getRetainedTypes().get());
EXPECT_EQ(Subprograms, N->getSubprograms().get());
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
EXPECT_EQ(ImportedEntities, N->getImportedEntities().get());
EXPECT_EQ(N, MDCompileUnit::get(Context, SourceLanguage, File, Producer,
IsOptimized, Flags, RuntimeVersion,
SplitDebugFilename, EmissionKind, EnumTypes,
@ -1400,18 +1400,18 @@ TEST_F(MDCompileUnitTest, replaceArrays) {
RetainedTypes, nullptr, nullptr, ImportedEntities);
auto *Subprograms = MDTuple::getDistinct(Context, None);
EXPECT_EQ(nullptr, N->getSubprograms());
EXPECT_EQ(nullptr, N->getSubprograms().get());
N->replaceSubprograms(Subprograms);
EXPECT_EQ(Subprograms, N->getSubprograms());
EXPECT_EQ(Subprograms, N->getSubprograms().get());
N->replaceSubprograms(nullptr);
EXPECT_EQ(nullptr, N->getSubprograms());
EXPECT_EQ(nullptr, N->getSubprograms().get());
auto *GlobalVariables = MDTuple::getDistinct(Context, None);
EXPECT_EQ(nullptr, N->getGlobalVariables());
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
N->replaceGlobalVariables(GlobalVariables);
EXPECT_EQ(GlobalVariables, N->getGlobalVariables());
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
N->replaceGlobalVariables(nullptr);
EXPECT_EQ(nullptr, N->getGlobalVariables());
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
}
typedef MetadataTest MDSubprogramTest;
@ -1457,9 +1457,9 @@ TEST_F(MDSubprogramTest, get) {
EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(IsOptimized, N->isOptimized());
EXPECT_EQ(Function, N->getFunction());
EXPECT_EQ(TemplateParams, N->getTemplateParams());
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
EXPECT_EQ(Declaration, N->getDeclaration());
EXPECT_EQ(Variables, N->getVariables());
EXPECT_EQ(Variables, N->getVariables().get());
EXPECT_EQ(N, MDSubprogram::get(Context, Scope, Name, LinkageName, File, Line,
Type, IsLocalToUnit, IsDefinition, ScopeLine,
ContainingType, Virtuality, VirtualIndex,