diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-09 01:14:04 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-09-09 01:14:04 +0000 |
commit | 6d9bc278eff5aea217afcaa0c58a4ab74e592804 (patch) | |
tree | 7fba890a2b14f952ac5d0e1f8e273341091f7e2a /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 4b82f9c37ade37516eeae82d3599da84eb1551e7 (diff) | |
download | bcm5719-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.cpp | 4 |
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; |