Fix crash when trying to generate debug info with program source from stdin
This commit is contained in:
11
module.cpp
11
module.cpp
@@ -118,6 +118,16 @@ Module::Module(const char *fn) {
|
||||
// If we're generating debugging symbols, let the DIBuilder know that
|
||||
// we're starting a new compilation unit.
|
||||
if (diBuilder != NULL) {
|
||||
if (filename == NULL) {
|
||||
// Unfortunately we can't yet call Error() since the global 'm'
|
||||
// variable hasn't been initialized yet.
|
||||
fprintf(stderr, "Can't emit debugging information with no "
|
||||
"source file on disk.\n");
|
||||
++errorCount;
|
||||
delete diBuilder;
|
||||
diBuilder = NULL;
|
||||
}
|
||||
else {
|
||||
std::string directory, name;
|
||||
GetDirectoryAndFileName(g->currentDirectory, filename, &directory,
|
||||
&name);
|
||||
@@ -129,6 +139,7 @@ Module::Module(const char *fn) {
|
||||
"-g", /* command line args */
|
||||
0 /* run time version */);
|
||||
}
|
||||
}
|
||||
#endif // LLVM_2_8
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user