mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
'-i' code was always getting emitted at -O2 regardless of the -O flag, which enables the "standard library hack" that pulls in IR for all of swift.swift. For -i optimization is often less important than responsiveness, so allow the optimization level to be specified by a flag and default to -O0 normally. Swift SVN r4518
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
//===-- Immediate.h - Entry point for swift immediate mode ----------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This is the entry point to the swift immediate mode, which takes a
|
|
// TranslationUnit, and runs it immediately using the JIT.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <string>
|
|
|
|
namespace swift {
|
|
class ASTContext;
|
|
class TranslationUnit;
|
|
class SILModule;
|
|
|
|
namespace irgen {
|
|
class Options;
|
|
}
|
|
|
|
/// Publicly available REPL state information.
|
|
class REPLContext {
|
|
public:
|
|
/// The index of the next response metavariable to bind to a REPL result.
|
|
unsigned NextResponseVariableIndex;
|
|
|
|
/// The SourceMgr buffer ID of the REPL input.
|
|
unsigned BufferID;
|
|
|
|
/// The index into the TranslationUnit's Decls at which to start
|
|
/// typechecking the next REPL input.
|
|
unsigned CurTUElem;
|
|
|
|
/// The index into the TranslationUnit's Decls at which to start
|
|
/// irgenning the next REPL input.
|
|
unsigned CurIRGenElem;
|
|
|
|
/// \brief Whether we have run replApplicationMain().
|
|
bool RanREPLApplicationMain;
|
|
};
|
|
|
|
void RunImmediately(irgen::Options &Options,
|
|
TranslationUnit *TU, SILModule *SILMod = nullptr);
|
|
void REPL(ASTContext &Context);
|
|
void REPLRunLoop(ASTContext &Context);
|
|
}
|