Implement debug info for willset/didset, and teach dispatch to be non-virtual

to didset/will set since we don't drop these in the class vtable.


Swift SVN r13056
This commit is contained in:
Chris Lattner
2014-01-28 06:33:31 +00:00
parent 7bcf701ee1
commit 290a58494e
7 changed files with 22 additions and 8 deletions

View File

@@ -366,11 +366,19 @@ llvm::DIFile IRGenDebugInfo::getOrCreateFile(const char *Filename) {
StringRef IRGenDebugInfo::getName(const FuncDecl &FD) {
// Getters and Setters are anonymous functions, so we forge a name
// using its parent declaration.
if (FD.isGetterOrSetter())
if (FD.isAccessor())
if (ValueDecl *VD = FD.getAccessorStorageDecl()) {
const char *Kind;
switch (FD.getAccessorKind()) {
case FuncDecl::NotAccessor: assert(0 && "we know this is an accessor");
case FuncDecl::IsGetter: Kind = ".get"; break;
case FuncDecl::IsSetter: Kind = ".set"; break;
case FuncDecl::IsWillSet: Kind = ".willset"; break;
case FuncDecl::IsDidSet: Kind = ".didset"; break;
}
SmallVector<char, 64> Buf;
StringRef Name = (VD->getName().str() +
Twine(FD.isGetter() ? ".get":".set")).toStringRef(Buf);
StringRef Name = (VD->getName().str() +Twine(Kind)).toStringRef(Buf);
return BumpAllocatedString(Name);
}