mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
Next step: implement an actual REPL. Swift SVN r1441
This commit is contained in:
@@ -113,6 +113,11 @@ static TUModuleCache &getTUCachePimpl(void *&Ptr, TranslationUnit &TU) {
|
||||
return *(TUModuleCache*)Ptr;
|
||||
}
|
||||
|
||||
static void freeTUCachePimpl(void *&Ptr) {
|
||||
delete (TUModuleCache*)Ptr;
|
||||
Ptr = 0;
|
||||
}
|
||||
|
||||
|
||||
/// Populate our cache on the first name lookup.
|
||||
TUModuleCache::TUModuleCache(TranslationUnit &TU) {
|
||||
@@ -191,6 +196,11 @@ static TUExtensionCache &getTUExtensionCachePimpl(void *&Ptr,
|
||||
return *(TUExtensionCache*)Ptr;
|
||||
}
|
||||
|
||||
static void freeTUExtensionCachePimpl(void *&Ptr) {
|
||||
delete (TUExtensionCache*)Ptr;
|
||||
Ptr = 0;
|
||||
}
|
||||
|
||||
TUExtensionCache::TUExtensionCache(TranslationUnit &TU) {
|
||||
for (auto Elt : TU.Body->getElements()) {
|
||||
if (Decl *D = Elt.dyn_cast<Decl*>()) {
|
||||
@@ -347,3 +357,11 @@ void Module::lookupGlobalExtensionMethods(Type BaseType, Identifier Name,
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TranslationUnit Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TranslationUnit::clearLookupCache() {
|
||||
freeTUCachePimpl(LookupCachePimpl);
|
||||
freeTUExtensionCachePimpl(ExtensionCachePimpl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user