diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-08 16:06:15 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-08 16:06:15 +0000 |
commit | cdba84c0d309be4312b08d0e7daa293c5305eba4 (patch) | |
tree | 76b02ab4e181c1519c6ca40294ebcb34c59df1fd /clang/lib/Tooling/CommonOptionsParser.cpp | |
parent | 590e5ff473fba9dcace9eee5fc59cb321a22811f (diff) | |
download | bcm5719-llvm-cdba84c0d309be4312b08d0e7daa293c5305eba4.tar.gz bcm5719-llvm-cdba84c0d309be4312b08d0e7daa293c5305eba4.zip |
CompilationDatabase: Sure-up ownership of compilation databases using std::unique_ptr
Diving into the memory leaks fixed by r213851 there was one case of a
memory leak of a CompilationDatabase due to not properly taking
ownership of the result of "CompilationDatabase::autoDetectFromSource".
Given that both implementations and callers have been using unique_ptr
to own CompilationDatabase objects - make this explicit in the API to
reduce the risk of further leaks.
llvm-svn: 215215
Diffstat (limited to 'clang/lib/Tooling/CommonOptionsParser.cpp')
-rw-r--r-- | clang/lib/Tooling/CommonOptionsParser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Tooling/CommonOptionsParser.cpp b/clang/lib/Tooling/CommonOptionsParser.cpp index e0b844c067d..c15f40d7f79 100644 --- a/clang/lib/Tooling/CommonOptionsParser.cpp +++ b/clang/lib/Tooling/CommonOptionsParser.cpp @@ -82,11 +82,11 @@ CommonOptionsParser::CommonOptionsParser(int &argc, const char **argv, if (!Compilations) { std::string ErrorMessage; if (!BuildPath.empty()) { - Compilations.reset(CompilationDatabase::autoDetectFromDirectory( - BuildPath, ErrorMessage)); + Compilations = + CompilationDatabase::autoDetectFromDirectory(BuildPath, ErrorMessage); } else { - Compilations.reset(CompilationDatabase::autoDetectFromSource( - SourcePaths[0], ErrorMessage)); + Compilations = CompilationDatabase::autoDetectFromSource(SourcePaths[0], + ErrorMessage); } if (!Compilations) llvm::report_fatal_error(ErrorMessage); |