Create a map from SILFunction -> SILDeclRef if a SILDeclRef was used to create the function.

The two ways functions are created currently is via the two
SILModule::getOrCreateFunction(). One of the methods, takes in a raw mangled
name and uses that to create the function. The other takes in a SILDeclRef to
generate the mangled name. Most function emission (besides some thunk creation
functions) goes through the latter. For now we update the map there. This is ok,
since this map will only be used to provide extra verification that guaranteed
self is occuring everywhere that it is supposed to (since constructors and
destructors still have @owned self).

Swift SVN r27240
This commit is contained in:
Michael Gottesman
2015-04-12 21:10:50 +00:00
parent 5e86341f79
commit bffbc8f92f
4 changed files with 53 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
#include "swift/SIL/SILModule.h"
// FIXME: For mapTypeInContext
#include "swift/AST/ArchetypeBuilder.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/GraphWriter.h"
@@ -454,3 +455,7 @@ ArrayRef<Substitution> SILFunction::getForwardingSubstitutions() {
return {};
return params->getForwardingSubstitutions(getASTContext());
}
llvm::Optional<SILDeclRef> SILFunction::getDeclRef() const {
return getModule().lookUpDeclRef(this);
}