Small code refactoring.

This commit is contained in:
Matt Pharr
2011-11-06 16:47:45 -08:00
parent cabe358c0a
commit 7a1ce558e9

View File

@@ -108,14 +108,11 @@ Module::Module(const char *fn) {
module = new llvm::Module(filename ? filename : "<stdin>", *g->ctx); module = new llvm::Module(filename ? filename : "<stdin>", *g->ctx);
module->setTargetTriple(g->target.GetTripleString()); module->setTargetTriple(g->target.GetTripleString());
if (g->generateDebuggingSymbols) if (g->generateDebuggingSymbols) {
diBuilder = new llvm::DIBuilder(*module); diBuilder = new llvm::DIBuilder(*module);
else
diBuilder = NULL;
// If we're generating debugging symbols, let the DIBuilder know that // Let the DIBuilder know that we're starting a new compilation
// we're starting a new compilation unit. // unit.
if (diBuilder != NULL) {
if (filename == NULL) { if (filename == NULL) {
// Unfortunately we can't yet call Error() since the global 'm' // Unfortunately we can't yet call Error() since the global 'm'
// variable hasn't been initialized yet. // variable hasn't been initialized yet.
@@ -138,6 +135,8 @@ Module::Module(const char *fn) {
0 /* run time version */); 0 /* run time version */);
} }
} }
else
diBuilder = NULL;
} }