mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Verifier: Add operand checks for remaining debug info
llvm-svn: 233565
This commit is contained in:
parent
552256692c
commit
2772e933dc
@ -282,8 +282,7 @@ protected:
|
||||
~MDScope() {}
|
||||
|
||||
public:
|
||||
// FIXME: Downcast to MDFile once we've verified all subclasses.
|
||||
Metadata *getFile() const { return getRawFile(); }
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
|
||||
/// \brief Return the raw underlying file.
|
||||
///
|
||||
@ -393,9 +392,6 @@ public:
|
||||
uint64_t getOffsetInBits() const { return OffsetInBits; }
|
||||
unsigned getFlags() const { return Flags; }
|
||||
|
||||
// FIXME: Remove this once MDScope::getFile() does the same.
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
|
||||
Metadata *getScope() const { return getRawScope(); }
|
||||
StringRef getName() const { return getStringOperand(2); }
|
||||
|
||||
@ -831,9 +827,6 @@ public:
|
||||
|
||||
TempMDCompileUnit clone() const { return cloneImpl(); }
|
||||
|
||||
// FIXME: Remove this once MDScope::getFile() does the same.
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
|
||||
unsigned getSourceLanguage() const { return SourceLanguage; }
|
||||
bool isOptimized() const { return IsOptimized; }
|
||||
unsigned getRuntimeVersion() const { return RuntimeVersion; }
|
||||
@ -1067,9 +1060,6 @@ public:
|
||||
bool isDefinition() const { return IsDefinition; }
|
||||
bool isOptimized() const { return IsOptimized; }
|
||||
|
||||
// FIXME: Remove this once MDScope::getFile() does the same.
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
|
||||
Metadata *getScope() const { return getRawScope(); }
|
||||
|
||||
StringRef getName() const { return getStringOperand(2); }
|
||||
@ -1129,9 +1119,6 @@ protected:
|
||||
~MDLexicalBlockBase() {}
|
||||
|
||||
public:
|
||||
// FIXME: Remove this once MDScope::getFile() does the same.
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
|
||||
MDLocalScope *getScope() const { return cast<MDLocalScope>(getRawScope()); }
|
||||
|
||||
Metadata *getRawScope() const { return getOperand(1); }
|
||||
@ -1252,8 +1239,8 @@ class MDNamespace : public MDScope {
|
||||
Line(Line) {}
|
||||
~MDNamespace() {}
|
||||
|
||||
static MDNamespace *getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
Metadata *File, StringRef Name, unsigned Line,
|
||||
static MDNamespace *getImpl(LLVMContext &Context, MDScope *Scope,
|
||||
MDFile *File, StringRef Name, unsigned Line,
|
||||
StorageType Storage, bool ShouldCreate = true) {
|
||||
return getImpl(Context, Scope, File, getCanonicalMDString(Context, Name),
|
||||
Line, Storage, ShouldCreate);
|
||||
@ -1268,8 +1255,8 @@ class MDNamespace : public MDScope {
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(MDNamespace, (Metadata * Scope, Metadata *File,
|
||||
StringRef Name, unsigned Line),
|
||||
DEFINE_MDNODE_GET(MDNamespace, (MDScope * Scope, MDFile *File, StringRef Name,
|
||||
unsigned Line),
|
||||
(Scope, File, Name, Line))
|
||||
DEFINE_MDNODE_GET(MDNamespace, (Metadata * Scope, Metadata *File,
|
||||
MDString *Name, unsigned Line),
|
||||
@ -1278,9 +1265,10 @@ public:
|
||||
TempMDNamespace clone() const { return cloneImpl(); }
|
||||
|
||||
unsigned getLine() const { return Line; }
|
||||
Metadata *getScope() const { return getOperand(1); }
|
||||
MDScope *getScope() const { return cast_or_null<MDScope>(getRawScope()); }
|
||||
StringRef getName() const { return getStringOperand(2); }
|
||||
|
||||
Metadata *getRawScope() const { return getOperand(1); }
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(2); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
@ -1730,9 +1718,9 @@ class MDObjCProperty : public DebugNode {
|
||||
~MDObjCProperty() {}
|
||||
|
||||
static MDObjCProperty *
|
||||
getImpl(LLVMContext &Context, StringRef Name, Metadata *File, unsigned Line,
|
||||
getImpl(LLVMContext &Context, StringRef Name, MDFile *File, unsigned Line,
|
||||
StringRef GetterName, StringRef SetterName, unsigned Attributes,
|
||||
Metadata *Type, StorageType Storage, bool ShouldCreate = true) {
|
||||
MDType *Type, StorageType Storage, bool ShouldCreate = true) {
|
||||
return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
|
||||
getCanonicalMDString(Context, GetterName),
|
||||
getCanonicalMDString(Context, SetterName), Attributes, Type,
|
||||
@ -1752,9 +1740,9 @@ class MDObjCProperty : public DebugNode {
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(MDObjCProperty,
|
||||
(StringRef Name, Metadata *File, unsigned Line,
|
||||
(StringRef Name, MDFile *File, unsigned Line,
|
||||
StringRef GetterName, StringRef SetterName,
|
||||
unsigned Attributes, Metadata *Type),
|
||||
unsigned Attributes, MDType *Type),
|
||||
(Name, File, Line, GetterName, SetterName, Attributes,
|
||||
Type))
|
||||
DEFINE_MDNODE_GET(MDObjCProperty,
|
||||
@ -1769,14 +1757,16 @@ public:
|
||||
unsigned getLine() const { return Line; }
|
||||
unsigned getAttributes() const { return Attributes; }
|
||||
StringRef getName() const { return getStringOperand(0); }
|
||||
Metadata *getFile() const { return getOperand(1); }
|
||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||
StringRef getGetterName() const { return getStringOperand(2); }
|
||||
StringRef getSetterName() const { return getStringOperand(3); }
|
||||
Metadata *getType() const { return getOperand(4); }
|
||||
MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
|
||||
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(0); }
|
||||
Metadata *getRawFile() const { return getOperand(1); }
|
||||
MDString *getRawGetterName() const { return getOperandAs<MDString>(2); }
|
||||
MDString *getRawSetterName() const { return getOperandAs<MDString>(3); }
|
||||
Metadata *getRawType() const { return getOperand(4); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == MDObjCPropertyKind;
|
||||
@ -1795,7 +1785,7 @@ class MDImportedEntity : public DebugNode {
|
||||
~MDImportedEntity() {}
|
||||
|
||||
static MDImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
|
||||
Metadata *Scope, Metadata *Entity,
|
||||
MDScope *Scope, Metadata *Entity,
|
||||
unsigned Line, StringRef Name,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
@ -1815,7 +1805,7 @@ class MDImportedEntity : public DebugNode {
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(MDImportedEntity,
|
||||
(unsigned Tag, Metadata *Scope, Metadata *Entity,
|
||||
(unsigned Tag, MDScope *Scope, Metadata *Entity,
|
||||
unsigned Line, StringRef Name = ""),
|
||||
(Tag, Scope, Entity, Line, Name))
|
||||
DEFINE_MDNODE_GET(MDImportedEntity,
|
||||
@ -1826,10 +1816,12 @@ public:
|
||||
TempMDImportedEntity clone() const { return cloneImpl(); }
|
||||
|
||||
unsigned getLine() const { return Line; }
|
||||
Metadata *getScope() const { return getOperand(0); }
|
||||
Metadata *getEntity() const { return getOperand(1); }
|
||||
MDScope *getScope() const { return cast_or_null<MDScope>(getRawScope()); }
|
||||
Metadata *getEntity() const { return getRawEntity(); }
|
||||
StringRef getName() const { return getStringOperand(2); }
|
||||
|
||||
Metadata *getRawScope() const { return getOperand(0); }
|
||||
Metadata *getRawEntity() const { return getOperand(1); }
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(2); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
|
@ -1681,8 +1681,8 @@ static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N,
|
||||
Out << "!MDNamespace(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("scope", N->getScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("file", N->getFile());
|
||||
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("file", N->getRawFile());
|
||||
Printer.printInt("line", N->getLine());
|
||||
Out << ")";
|
||||
}
|
||||
@ -1778,12 +1778,12 @@ static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N,
|
||||
Out << "!MDObjCProperty(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("file", N->getFile());
|
||||
Printer.printMetadata("file", N->getRawFile());
|
||||
Printer.printInt("line", N->getLine());
|
||||
Printer.printString("setter", N->getSetterName());
|
||||
Printer.printString("getter", N->getGetterName());
|
||||
Printer.printInt("attributes", N->getAttributes());
|
||||
Printer.printMetadata("type", N->getType());
|
||||
Printer.printMetadata("type", N->getRawType());
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
@ -1794,8 +1794,8 @@ static void writeMDImportedEntity(raw_ostream &Out, const MDImportedEntity *N,
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("scope", N->getScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("entity", N->getEntity());
|
||||
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("entity", N->getRawEntity());
|
||||
Printer.printInt("line", N->getLine());
|
||||
Out << ")";
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
|
||||
DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
|
||||
DIFile File, unsigned LineNo) {
|
||||
DINameSpace R = MDNamespace::get(VMContext, getNonCompileUnitScope(Scope),
|
||||
File.getFileNode(), Name, LineNo);
|
||||
File, Name, LineNo);
|
||||
assert(R.Verify() &&
|
||||
"createNameSpace should return a verifiable DINameSpace");
|
||||
return R;
|
||||
|
@ -635,11 +635,11 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
|
||||
MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line)
|
||||
: Scope(Scope), File(File), Name(Name), Line(Line) {}
|
||||
MDNodeKeyImpl(const MDNamespace *N)
|
||||
: Scope(N->getScope()), File(N->getFile()), Name(N->getName()),
|
||||
: Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()),
|
||||
Line(N->getLine()) {}
|
||||
|
||||
bool isKeyOf(const MDNamespace *RHS) const {
|
||||
return Scope == RHS->getScope() && File == RHS->getFile() &&
|
||||
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
|
||||
Name == RHS->getName() && Line == RHS->getLine();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
@ -789,15 +789,15 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> {
|
||||
: Name(Name), File(File), Line(Line), GetterName(GetterName),
|
||||
SetterName(SetterName), Attributes(Attributes), Type(Type) {}
|
||||
MDNodeKeyImpl(const MDObjCProperty *N)
|
||||
: Name(N->getName()), File(N->getFile()), Line(N->getLine()),
|
||||
: Name(N->getName()), File(N->getRawFile()), Line(N->getLine()),
|
||||
GetterName(N->getGetterName()), SetterName(N->getSetterName()),
|
||||
Attributes(N->getAttributes()), Type(N->getType()) {}
|
||||
Attributes(N->getAttributes()), Type(N->getRawType()) {}
|
||||
|
||||
bool isKeyOf(const MDObjCProperty *RHS) const {
|
||||
return Name == RHS->getName() && File == RHS->getFile() &&
|
||||
return Name == RHS->getName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && GetterName == RHS->getGetterName() &&
|
||||
SetterName == RHS->getSetterName() &&
|
||||
Attributes == RHS->getAttributes() && Type == RHS->getType();
|
||||
Attributes == RHS->getAttributes() && Type == RHS->getRawType();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
return hash_combine(Name, File, Line, GetterName, SetterName, Attributes,
|
||||
@ -816,12 +816,12 @@ template <> struct MDNodeKeyImpl<MDImportedEntity> {
|
||||
StringRef Name)
|
||||
: Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
|
||||
MDNodeKeyImpl(const MDImportedEntity *N)
|
||||
: Tag(N->getTag()), Scope(N->getScope()), Entity(N->getEntity()),
|
||||
: Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
|
||||
Line(N->getLine()), Name(N->getName()) {}
|
||||
|
||||
bool isKeyOf(const MDImportedEntity *RHS) const {
|
||||
return Tag == RHS->getTag() && Scope == RHS->getScope() &&
|
||||
Entity == RHS->getEntity() && Line == RHS->getLine() &&
|
||||
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
|
||||
Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
|
||||
Name == RHS->getName();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
|
@ -303,6 +303,7 @@ private:
|
||||
void visitMDDerivedTypeBase(const MDDerivedTypeBase &N);
|
||||
void visitMDVariable(const MDVariable &N);
|
||||
void visitMDLexicalBlockBase(const MDLexicalBlockBase &N);
|
||||
void visitMDTemplateParameter(const MDTemplateParameter &N);
|
||||
|
||||
// InstVisitor overrides...
|
||||
using InstVisitor<Verifier>::visit;
|
||||
@ -681,6 +682,15 @@ static bool isScopeRef(const Metadata *MD) {
|
||||
return isa<MDScope>(MD);
|
||||
}
|
||||
|
||||
/// \brief Check if a value can be a debug info ref.
|
||||
static bool isDIRef(const Metadata *MD) {
|
||||
if (!MD)
|
||||
return true;
|
||||
if (auto *S = dyn_cast<MDString>(MD))
|
||||
return !S->getString().empty();
|
||||
return isa<DebugNode>(MD);
|
||||
}
|
||||
|
||||
template <class Ty>
|
||||
bool isValidMetadataArrayImpl(const MDTuple &N, bool AllowNull) {
|
||||
for (Metadata *MD : N.operands()) {
|
||||
@ -890,15 +900,25 @@ void Verifier::visitMDLexicalBlockFile(const MDLexicalBlockFile &N) {
|
||||
|
||||
void Verifier::visitMDNamespace(const MDNamespace &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_namespace, "invalid tag", &N);
|
||||
if (auto *S = N.getRawScope())
|
||||
Assert(isa<MDScope>(S), "invalid scope ref", &N, S);
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateParameter(const MDTemplateParameter &N) {
|
||||
Assert(isTypeRef(N.getType()), "invalid type ref", &N, N.getType());
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateTypeParameter(const MDTemplateTypeParameter &N) {
|
||||
visitMDTemplateParameter(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_template_type_parameter, "invalid tag",
|
||||
&N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateValueParameter(
|
||||
const MDTemplateValueParameter &N) {
|
||||
visitMDTemplateParameter(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_template_value_parameter ||
|
||||
N.getTag() == dwarf::DW_TAG_GNU_template_template_param ||
|
||||
N.getTag() == dwarf::DW_TAG_GNU_template_parameter_pack,
|
||||
@ -949,12 +969,19 @@ void Verifier::visitMDExpression(const MDExpression &N) {
|
||||
|
||||
void Verifier::visitMDObjCProperty(const MDObjCProperty &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
|
||||
if (auto *T = N.getRawType())
|
||||
Assert(isa<MDType>(T), "invalid type ref", &N, T);
|
||||
if (auto *F = N.getRawFile())
|
||||
Assert(isa<MDFile>(F), "invalid file", &N, F);
|
||||
}
|
||||
|
||||
void Verifier::visitMDImportedEntity(const MDImportedEntity &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_imported_module ||
|
||||
N.getTag() == dwarf::DW_TAG_imported_declaration,
|
||||
"invalid tag", &N);
|
||||
if (auto *S = N.getRawScope())
|
||||
Assert(isa<MDScope>(S), "invalid scope for imported entity", &N, S);
|
||||
Assert(isDIRef(N.getEntity()), "invalid imported entity", &N, N.getEntity());
|
||||
}
|
||||
|
||||
void Verifier::visitComdat(const Comdat &C) {
|
||||
|
@ -4,10 +4,10 @@
|
||||
; CHECK: !named = !{!0, !1, !2, !3, !3}
|
||||
!named = !{!0, !1, !2, !3, !4}
|
||||
|
||||
; CHECK: !0 = distinct !{}
|
||||
; CHECK-NEXT: !1 = distinct !{}
|
||||
!0 = distinct !{}
|
||||
!1 = distinct !{}
|
||||
; CHECK: !0 = !MDSubprogram({{.*}})
|
||||
; CHECK-NEXT: !1 = !MDCompositeType({{.*}})
|
||||
!0 = !MDSubprogram(name: "foo")
|
||||
!1 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Class", size: 32, align: 32)
|
||||
|
||||
; CHECK-NEXT: !2 = !MDImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0, entity: !1, line: 7)
|
||||
!2 = !MDImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0,
|
||||
|
@ -4,7 +4,7 @@
|
||||
; CHECK: !named = !{!0, !1, !2, !3, !4, !4}
|
||||
!named = !{!0, !1, !2, !3, !4, !5}
|
||||
|
||||
!0 = distinct !{}
|
||||
!0 = !MDFile(filename: "file.cpp", directory: "/path/to/dir")
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!2 = distinct !{}
|
||||
!2 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Object")
|
||||
|
||||
|
||||
; CHECK: !2 = distinct !{}
|
||||
; CHECK: !2 = !MDCompositeType({{.*}})
|
||||
; CHECK-NEXT: !3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo", getter: "getFoo", attributes: 7, type: !2)
|
||||
!3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
getter: "getFoo", attributes: 7, type: !2)
|
||||
|
@ -5,8 +5,8 @@
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = distinct !{}
|
||||
; CHECK: !1 = distinct !{}
|
||||
!1 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
; CHECK: !1 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
|
||||
; CHECK-NEXT: !2 = !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
; CHECK-NEXT: !3 = !MDTemplateTypeParameter(type: !1)
|
||||
|
@ -1608,8 +1608,8 @@ TEST_F(MDLexicalBlockFileTest, get) {
|
||||
typedef MetadataTest MDNamespaceTest;
|
||||
|
||||
TEST_F(MDNamespaceTest, get) {
|
||||
Metadata *Scope = MDTuple::getDistinct(Context, None);
|
||||
Metadata *File = MDTuple::getDistinct(Context, None);
|
||||
MDScope *Scope = getFile();
|
||||
MDFile *File = getFile();
|
||||
StringRef Name = "namespace";
|
||||
unsigned Line = 5;
|
||||
|
||||
@ -1622,8 +1622,8 @@ TEST_F(MDNamespaceTest, get) {
|
||||
EXPECT_EQ(Line, N->getLine());
|
||||
EXPECT_EQ(N, MDNamespace::get(Context, Scope, File, Name, Line));
|
||||
|
||||
EXPECT_NE(N, MDNamespace::get(Context, File, File, Name, Line));
|
||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, Scope, Name, Line));
|
||||
EXPECT_NE(N, MDNamespace::get(Context, getFile(), File, Name, Line));
|
||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, getFile(), Name, Line));
|
||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, "other", Line));
|
||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, Name, Line + 1));
|
||||
|
||||
@ -1635,8 +1635,7 @@ typedef MetadataTest MDTemplateTypeParameterTest;
|
||||
|
||||
TEST_F(MDTemplateTypeParameterTest, get) {
|
||||
StringRef Name = "template";
|
||||
Metadata *Type = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Other = MDTuple::getDistinct(Context, None);
|
||||
MDType *Type = getBasicType("basic");
|
||||
|
||||
auto *N = MDTemplateTypeParameter::get(Context, Name, Type);
|
||||
|
||||
@ -1646,7 +1645,8 @@ TEST_F(MDTemplateTypeParameterTest, get) {
|
||||
EXPECT_EQ(N, MDTemplateTypeParameter::get(Context, Name, Type));
|
||||
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, "other", Type));
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Name, Other));
|
||||
EXPECT_NE(N,
|
||||
MDTemplateTypeParameter::get(Context, Name, getBasicType("other")));
|
||||
|
||||
TempMDTemplateTypeParameter Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1657,9 +1657,8 @@ typedef MetadataTest MDTemplateValueParameterTest;
|
||||
TEST_F(MDTemplateValueParameterTest, get) {
|
||||
unsigned Tag = dwarf::DW_TAG_template_value_parameter;
|
||||
StringRef Name = "template";
|
||||
Metadata *Type = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Value = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Other = MDTuple::getDistinct(Context, None);
|
||||
MDType *Type = getBasicType("basic");
|
||||
Metadata *Value = getConstantAsMetadata();
|
||||
|
||||
auto *N = MDTemplateValueParameter::get(Context, Tag, Name, Type, Value);
|
||||
EXPECT_EQ(Tag, N->getTag());
|
||||
@ -1673,9 +1672,10 @@ TEST_F(MDTemplateValueParameterTest, get) {
|
||||
Type, Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, "other", Type,
|
||||
Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name, Other,
|
||||
Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name, Type, Other));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name,
|
||||
getBasicType("other"), Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name, Type,
|
||||
getConstantAsMetadata()));
|
||||
|
||||
TempMDTemplateValueParameter Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1877,12 +1877,12 @@ typedef MetadataTest MDObjCPropertyTest;
|
||||
|
||||
TEST_F(MDObjCPropertyTest, get) {
|
||||
StringRef Name = "name";
|
||||
Metadata *File = MDTuple::getDistinct(Context, None);
|
||||
MDFile *File = getFile();
|
||||
unsigned Line = 5;
|
||||
StringRef GetterName = "getter";
|
||||
StringRef SetterName = "setter";
|
||||
unsigned Attributes = 7;
|
||||
Metadata *Type = MDTuple::getDistinct(Context, None);
|
||||
MDType *Type = getBasicType("basic");
|
||||
|
||||
auto *N = MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
||||
SetterName, Attributes, Type);
|
||||
@ -1900,7 +1900,7 @@ TEST_F(MDObjCPropertyTest, get) {
|
||||
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, "other", File, Line, GetterName,
|
||||
SetterName, Attributes, Type));
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, Type, Line, GetterName,
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, getFile(), Line, GetterName,
|
||||
SetterName, Attributes, Type));
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, File, Line + 1, GetterName,
|
||||
SetterName, Attributes, Type));
|
||||
@ -1910,8 +1910,9 @@ TEST_F(MDObjCPropertyTest, get) {
|
||||
"other", Attributes, Type));
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
||||
SetterName, Attributes + 1, Type));
|
||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
||||
SetterName, Attributes, File));
|
||||
EXPECT_NE(N,
|
||||
MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
||||
SetterName, Attributes, getBasicType("other")));
|
||||
|
||||
TempMDObjCProperty Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1921,8 +1922,8 @@ typedef MetadataTest MDImportedEntityTest;
|
||||
|
||||
TEST_F(MDImportedEntityTest, get) {
|
||||
unsigned Tag = dwarf::DW_TAG_imported_module;
|
||||
Metadata *Scope = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Entity = MDTuple::getDistinct(Context, None);
|
||||
MDScope *Scope = getSubprogram();
|
||||
DebugNode *Entity = getCompositeType();
|
||||
unsigned Line = 5;
|
||||
StringRef Name = "name";
|
||||
|
||||
@ -1938,8 +1939,10 @@ TEST_F(MDImportedEntityTest, get) {
|
||||
EXPECT_NE(N,
|
||||
MDImportedEntity::get(Context, dwarf::DW_TAG_imported_declaration,
|
||||
Scope, Entity, Line, Name));
|
||||
EXPECT_NE(N, MDImportedEntity::get(Context, Tag, Entity, Entity, Line, Name));
|
||||
EXPECT_NE(N, MDImportedEntity::get(Context, Tag, Scope, Scope, Line, Name));
|
||||
EXPECT_NE(N, MDImportedEntity::get(Context, Tag, getSubprogram(), Entity,
|
||||
Line, Name));
|
||||
EXPECT_NE(N, MDImportedEntity::get(Context, Tag, Scope, getCompositeType(),
|
||||
Line, Name));
|
||||
EXPECT_NE(N,
|
||||
MDImportedEntity::get(Context, Tag, Scope, Entity, Line + 1, Name));
|
||||
EXPECT_NE(N,
|
||||
|
Loading…
Reference in New Issue
Block a user