[Tooling] Remove redundant check, NFCi
authorKrasimir Georgiev <krasimir@google.com>
Fri, 5 May 2017 14:07:23 +0000 (14:07 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Fri, 5 May 2017 14:07:23 +0000 (14:07 +0000)
Summary: The Database check looks redundant.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D32909

llvm-svn: 302236

clang/lib/Tooling/JSONCompilationDatabase.cpp

index 738e610..f9a230e 100644 (file)
@@ -146,12 +146,8 @@ class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin {
   loadFromDirectory(StringRef Directory, std::string &ErrorMessage) override {
     SmallString<1024> JSONDatabasePath(Directory);
     llvm::sys::path::append(JSONDatabasePath, "compile_commands.json");
-    std::unique_ptr<CompilationDatabase> Database(
-        JSONCompilationDatabase::loadFromFile(
-            JSONDatabasePath, ErrorMessage, JSONCommandLineSyntax::AutoDetect));
-    if (!Database)
-      return nullptr;
-    return Database;
+    return JSONCompilationDatabase::loadFromFile(
+        JSONDatabasePath, ErrorMessage, JSONCommandLineSyntax::AutoDetect);
   }
 };