Debug Info! Add basic support for line tables, compilation units, files,

and lexical scopes, which can be enabled through the new -g option.
When -g is enabled, line tables and scopes compile all the way
down to DWARF.

Changes to SIL:
- In addition to a SILLocation, every instruction now also has a pointer
  to a SILDebugScope (its containing lexical scope).
- Added LexicalScope, which is to be used for all Scopes we want to show
  up in the debug info.

Swift SVN r5772
This commit is contained in:
Adrian Prantl
2013-06-23 00:09:17 +00:00
parent 196381780a
commit 0f7533dc7e
13 changed files with 401 additions and 15 deletions

View File

@@ -30,6 +30,7 @@
#include "GenType.h"
#include "IRGenModule.h"
#include "IRGenDebugInfo.h"
#include "Linking.h"
#include <initializer_list>
@@ -61,7 +62,7 @@ IRGenModule::IRGenModule(ASTContext &Context,
Options &Opts, llvm::Module &Module,
const llvm::DataLayout &DataLayout,
SILModule *SILMod)
: Context(Context), Opts(Opts),
: Context(Context), Opts(Opts), DebugInfo(0),
Module(Module), LLVMContext(Module.getContext()),
DataLayout(DataLayout), SILMod(SILMod),
Types(*new TypeConverter(*this)) {
@@ -173,10 +174,15 @@ IRGenModule::IRGenModule(ASTContext &Context,
// TODO: use "tinycc" on platforms that support it
RuntimeCC = llvm::CallingConv::C;
if (Opts.DebugInfo)
DebugInfo = new IRGenDebugInfo(Context.SourceMgr, Module);
}
IRGenModule::~IRGenModule() {
delete &Types;
if (DebugInfo)
delete DebugInfo;
}
static llvm::Constant *getRuntimeFn(IRGenModule &IGM,