[PATCH] D32909: [Tooling] Remove redundant check, NFCi

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 07:06:44 PDT 2017


krasimir created this revision.
Herald added a subscriber: klimek.

The Database check looks redundant.


https://reviews.llvm.org/D32909

Files:
  lib/Tooling/JSONCompilationDatabase.cpp


Index: lib/Tooling/JSONCompilationDatabase.cpp
===================================================================
--- lib/Tooling/JSONCompilationDatabase.cpp
+++ lib/Tooling/JSONCompilationDatabase.cpp
@@ -146,12 +146,8 @@
   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);
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32909.97952.patch
Type: text/x-patch
Size: 815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170505/31690912/attachment.bin>


More information about the cfe-commits mailing list