Prechádzať zdrojové kódy

Use auto for parseBitcodeFile result. (#1816)

Xiang Li 6 rokov pred
rodič
commit
48595a358c
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      lib/DXIL/DxilUtil.cpp

+ 2 - 3
lib/DXIL/DxilUtil.cpp

@@ -192,9 +192,8 @@ std::unique_ptr<llvm::Module> LoadModuleFromBitcode(llvm::MemoryBuffer *MB,
   llvm::LLVMContext &Ctx,
   llvm::LLVMContext &Ctx,
   std::string &DiagStr) {
   std::string &DiagStr) {
   // Note: the DiagStr is not used.
   // Note: the DiagStr is not used.
-  ErrorOr<std::unique_ptr<llvm::Module>> pModule(
-    llvm::parseBitcodeFile(MB->getMemBufferRef(), Ctx));
-  if (std::error_code ec = pModule.getError()) {
+  auto pModule = llvm::parseBitcodeFile(MB->getMemBufferRef(), Ctx);
+  if (!pModule) {
     return nullptr;
     return nullptr;
   }
   }
   return std::unique_ptr<llvm::Module>(pModule.get().release());
   return std::unique_ptr<llvm::Module>(pModule.get().release());