aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-27 17:33:40 +0000
committerDan Gohman <gohman@apple.com>2010-05-27 17:33:40 +0000
commit6f118975f9ca6318a933ee4bfad19fae628c9a8d (patch)
treedbf88e00d901b577aa1eb3f647876483b6e0fd12
parenta7f1c008d37927a2ffc55a95830b42762db24843 (diff)
MemoryBuffer::getSTDIN may return a null pointer if an error occurs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104856 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Frontend/CompilerInstance.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 2b251682b7..8bedf50c27 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -442,7 +442,7 @@ bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile,
}
} else {
llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
- SourceMgr.createMainFileIDForMemBuffer(SB);
+ if (SB) SourceMgr.createMainFileIDForMemBuffer(SB);
if (SourceMgr.getMainFileID().isInvalid()) {
Diags.Report(diag::err_fe_error_reading_stdin);
return false;