[PATCH] D27138: Extend CompilationDatabase by a field for the output filename

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 05:28:35 PST 2016


klimek added inline comments.


================
Comment at: lib/Tooling/JSONCompilationDatabase.cpp:266
+        nodeToCommandLine(Syntax, std::get<2>(CommandsRef[I])),
+        Output ? Output->getValue(OutputStorage) : "");
   }
----------------
joerg wrote:
> klimek wrote:
> > joerg wrote:
> > > klimek wrote:
> > > > joerg wrote:
> > > > > klimek wrote:
> > > > > > Optional: I'd probably let the nodeToCommandLine handle the null value and make this code more straight forward?
> > > > > I couldn't find a way to create a synthetic node without changing the YAML API.
> > > > I'm probably missing something - why would we need a synthetic node? Can't we just put nullptr into the vector?
> > > That's what I am doing and why this line checks output :)
> > Ok, let's ask differently: why is it a problem if we put a nullptr into the array?
> I think it just adds unnecessary complexity. An empty file name is not a valid output, so "" vs Optional has the same result. I'd have prefered to keep this complexity inside the JSON parser, but that would have meant creating a synthetic node with value "" and there is no API for that at the moment.
Don't we thus want to actually be able to err out on a higher level when getting an empty output dir, but be OK with an unspecified (-> nullptr) one?


Repository:
  rL LLVM

https://reviews.llvm.org/D27138





More information about the cfe-commits mailing list