summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-09 01:14:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-09 01:14:04 +0000
commit6d9bc278eff5aea217afcaa0c58a4ab74e592804 (patch)
tree7fba890a2b14f952ac5d0e1f8e273341091f7e2a /clang/lib/Frontend/CompilerInstance.cpp
parent4b82f9c37ade37516eeae82d3599da84eb1551e7 (diff)
downloadbcm5719-llvm-6d9bc278eff5aea217afcaa0c58a4ab74e592804.tar.gz
bcm5719-llvm-6d9bc278eff5aea217afcaa0c58a4ab74e592804.zip
Fix ownership of the MemoryBuffer in a FrontendInputFile.
This fixes a possible crash on certain kinds of corrupted AST file, but checking in an AST file corrupted in just the right way will be a maintenance nightmare because the format changes frequently. llvm-svn: 312851
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 128de2840e4..5c1678262c1 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -838,8 +838,8 @@ bool CompilerInstance::InitializeSourceManager(
: Input.isSystem() ? SrcMgr::C_System : SrcMgr::C_User;
if (Input.isBuffer()) {
- SourceMgr.setMainFileID(SourceMgr.createFileID(
- std::unique_ptr<llvm::MemoryBuffer>(Input.getBuffer()), Kind));
+ SourceMgr.setMainFileID(SourceMgr.createFileID(SourceManager::Unowned,
+ Input.getBuffer(), Kind));
assert(SourceMgr.getMainFileID().isValid() &&
"Couldn't establish MainFileID!");
return true;
OpenPOWER on IntegriCloud