mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Implement getting subscripts.
Subscripts are just another kind of property. Refactor some logic from ApplyExpr codegen to visit index arguments consistently with apply arguments. Also move the logic for determining SIL constant types onto SILModule because it's too hairy to calculate on the fly. Swift SVN r3452
This commit is contained in:
@@ -20,7 +20,9 @@ namespace {
|
||||
/// SILVerifier class - This class implements the SIL verifier, which walks over
|
||||
/// SIL, checking and enforcing its invariants.
|
||||
class SILVerifier : public SILVisitor<SILVerifier> {
|
||||
SILModule &M;
|
||||
public:
|
||||
SILVerifier(SILModule &M) : M(M) {}
|
||||
|
||||
void visit(Instruction *I) {
|
||||
|
||||
@@ -75,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
void visitConstantRefInst(ConstantRefInst *DRI) {
|
||||
assert(DRI->getConstant().getType()->getCanonicalType() ==
|
||||
assert(M.getConstantType(DRI->getConstant())->getCanonicalType() ==
|
||||
DRI->getType()->getCanonicalType()
|
||||
&& "ConstantRef type does not match constant's type");
|
||||
}
|
||||
@@ -197,5 +199,5 @@ public:
|
||||
/// verify - Run the IR verifier to make sure that the Function follows
|
||||
/// invariants.
|
||||
void Function::verify() const {
|
||||
SILVerifier().visitFunction(const_cast<Function*>(this));
|
||||
SILVerifier(Module).visitFunction(const_cast<Function*>(this));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user