SILArgument: Make Decls mandatory for function arguments.

Swift SVN r11099
This commit is contained in:
Adrian Prantl
2013-12-10 23:30:23 +00:00
parent 61318e33f0
commit 2acb71831e
8 changed files with 100 additions and 45 deletions

View File

@@ -26,8 +26,20 @@ using namespace swift;
// SILArgument Implementation
//===----------------------------------------------------------------------===//
SILArgument::SILArgument(SILType Ty, SILBasicBlock *ParentBB, ValueDecl *D)
SILArgument::SILArgument(SILType Ty, SILBasicBlock *ParentBB, const ValueDecl *D)
: ValueBase(ValueKind::SILArgument, Ty), ParentBB(ParentBB), Decl(D) {
// Function arguments need to have a decl.
assert(
// Unless the function is transparent,
!ParentBB->getParent()->isTransparent() &&
// or an ObjC thunk,
ParentBB->getParent()->getAbstractCC() != AbstractCC::ObjCMethod &&
// or comes from a SIL file.
!ParentBB->getParent()->getLocation().is<SILFileLocation>() &&
// Is this the initial basic block in the function?
ParentBB->getParent()->size() == 1
? D != nullptr
: true );
ParentBB->addArgument(this);
}