mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Verifier: Check fields of MDVariable subclasses
Check fields from `MDLocalVariable` and `MDGlobalVariable` and change the accessors to downcast to the right types. `getType()` still returns `Metadata*` since it could be an `MDString`-based reference. Since local variables require non-null scopes, I also updated `LLParser` to require a `scope:` field. A number of testcases had grown bitrot and started failing with this patch; I committed them separately in r233349. If I just broke your out-of-tree testcases, you're probably hitting similar problems (so have a look there). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233389 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -699,21 +699,22 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
IsDefinition(IsDefinition), Variable(Variable),
|
||||
StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
|
||||
MDNodeKeyImpl(const MDGlobalVariable *N)
|
||||
: Scope(N->getScope()), Name(N->getName()),
|
||||
LinkageName(N->getLinkageName()), File(N->getFile()),
|
||||
Line(N->getLine()), Type(N->getType()),
|
||||
: Scope(N->getRawScope()), Name(N->getName()),
|
||||
LinkageName(N->getLinkageName()), File(N->getRawFile()),
|
||||
Line(N->getLine()), Type(N->getRawType()),
|
||||
IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
|
||||
Variable(N->getVariable()),
|
||||
StaticDataMemberDeclaration(N->getStaticDataMemberDeclaration()) {}
|
||||
Variable(N->getRawVariable()),
|
||||
StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
|
||||
|
||||
bool isKeyOf(const MDGlobalVariable *RHS) const {
|
||||
return Scope == RHS->getScope() && Name == RHS->getName() &&
|
||||
LinkageName == RHS->getLinkageName() && File == RHS->getFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getType() &&
|
||||
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
|
||||
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getRawType() &&
|
||||
IsLocalToUnit == RHS->isLocalToUnit() &&
|
||||
IsDefinition == RHS->isDefinition() &&
|
||||
Variable == RHS->getVariable() &&
|
||||
StaticDataMemberDeclaration == RHS->getStaticDataMemberDeclaration();
|
||||
Variable == RHS->getRawVariable() &&
|
||||
StaticDataMemberDeclaration ==
|
||||
RHS->getRawStaticDataMemberDeclaration();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
return hash_combine(Scope, Name, LinkageName, File, Line, Type,
|
||||
@@ -739,16 +740,17 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
|
||||
: Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
|
||||
Arg(Arg), Flags(Flags), InlinedAt(InlinedAt) {}
|
||||
MDNodeKeyImpl(const MDLocalVariable *N)
|
||||
: Tag(N->getTag()), Scope(N->getScope()), Name(N->getName()),
|
||||
File(N->getFile()), Line(N->getLine()), Type(N->getType()),
|
||||
Arg(N->getArg()), Flags(N->getFlags()), InlinedAt(N->getInlinedAt()) {}
|
||||
: Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
|
||||
File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
|
||||
Arg(N->getArg()), Flags(N->getFlags()),
|
||||
InlinedAt(N->getRawInlinedAt()) {}
|
||||
|
||||
bool isKeyOf(const MDLocalVariable *RHS) const {
|
||||
return Tag == RHS->getTag() && Scope == RHS->getScope() &&
|
||||
Name == RHS->getName() && File == RHS->getFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getType() &&
|
||||
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
|
||||
Name == RHS->getName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getRawType() &&
|
||||
Arg == RHS->getArg() && Flags == RHS->getFlags() &&
|
||||
InlinedAt == RHS->getInlinedAt();
|
||||
InlinedAt == RHS->getRawInlinedAt();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags,
|
||||
|
Reference in New Issue
Block a user