Introduce a LangOptions class to capture various type-checker-tweaking flags. For now, introduce bits to enable the constraint solver and to enable debugging of the constraint solver, and use those to eliminate the "useConstraintSolver" bit that was threaded through too much of the type checker.

Swift SVN r2836
This commit is contained in:
Doug Gregor
2012-09-12 20:19:33 +00:00
parent 693318642d
commit 42b1ab6fbd
12 changed files with 96 additions and 40 deletions

View File

@@ -34,6 +34,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/system_error.h"
@@ -305,8 +306,7 @@ void swift::REPL(ASTContext &Context) {
swift::appendToMainTranslationUnit(TU, BufferID, CurTUElem,
CurBufferOffset,
CurBufferEndOffset,
/*useConstraintSolver=*/false);
CurBufferEndOffset);
if (Context.hadError())
return;
@@ -418,11 +418,12 @@ void swift::REPL(ASTContext &Context) {
continue;
// Parse the current line(s).
llvm::SaveAndRestore<bool> setUseConstraintSolver(
TU->getASTContext().LangOpts.UseConstraintSolver, useConstraintSolver);
bool ShouldRun =
swift::appendToMainTranslationUnit(TU, BufferID, CurTUElem,
CurBufferOffset,
CurBufferEndOffset,
useConstraintSolver);
CurBufferEndOffset);
if (useConstraintSolver) {
useConstraintSolver = false;
ShouldRun = false;