================
@@ -1049,31 +1047,33 @@ static llvm::Error CopyFile(StringRef FilePath, 
StringRef OutDirectory) {
   std::error_code FileErr = llvm::sys::fs::copy_file(PathRead, PathWrite);
   if (FileErr != OK) {
     return llvm::createStringError(llvm::inconvertibleErrorCode(),
-                                   "error creating file " +
-                                       llvm::sys::path::filename(FilePath) +
-                                       ": " + FileErr.message() + "\n");
+                                   "error creating file " + FilePath + ": " +
+                                       FileErr.message() + "\n");
   }
   return llvm::Error::success();
 }
 
 llvm::Error HTMLGenerator::createResources(ClangDocContext &CDCtx) {
-  auto Err = SerializeIndex(CDCtx);
-  if (Err)
+  if (auto Err = SerializeIndex(CDCtx)) {
     return Err;
-  Err = GenIndex(CDCtx);
-  if (Err)
+  }
----------------
ilovepi wrote:

I'm not sure updating the error handling here and below is a functional 
improvement. However, even if it is, it belongs in a separate PR, as its 
unrelated to the work done in this patch. While we normally don't use `auto` 
that much in llvm (see 
https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable),
 an error code is probably an OK time to use one. Unfortunately, these APIs 
don't seem to obviously return an error based on their signatures, so you may 
want to consider using an explicit type (but its not required). Lastly, our 
style guide only uses braces for conditionals w/ multiple lines (see 
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements).
 

https://github.com/llvm/llvm-project/pull/93276
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to