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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 04:16:53 PST 2016


klimek added inline comments.


================
Comment at: lib/Format/Format.cpp:1920-1922
+  std::error_code EC = FS->makeAbsolute(Path);
+  assert(!EC);
+  (void)EC;
----------------
amaiorano wrote:
> 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.
> 
I don't think it's overly important in this case. Generally, I like a good error message more than an assert that gives me no info on what happened...


https://reviews.llvm.org/D27971





More information about the cfe-commits mailing list