[PATCH] D27971: Make FormatStyle.GetStyleOfFile test work on MSVC

Antonio Maiorano via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 03:44:12 PST 2016


amaiorano added inline comments.


================
Comment at: lib/Format/Format.cpp:1920-1922
+  std::error_code EC = FS->makeAbsolute(Path);
+  assert(!EC);
+  (void)EC;
----------------
klimek wrote:
> I think if makeAbsolute doesn't work, we will probably want to err out here:
> if (EC) {
>   llvm::errs() << ... << EC.message << ...
>   return Style;
> }
Okay. I based myself on the fact that the old code didn't do error checking on fs::make_absolute - in fact most calls to fs::make_absolute in the codebase assert on the result. I suppose it's because it's just a string manipulation function, and if it fails, the subsequent code that will make use of the path will fail with a more useful error.

In any case, I don't mind handling the error here as you propose.



https://reviews.llvm.org/D27971





More information about the cfe-commits mailing list