[PATCH] D45899: TableGen: Add a --write-if-changed flag to tablegen directly instead of doing it in cmake.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 23 17:50:34 PDT 2018
rnk accepted this revision.
rnk added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/TableGen/Main.cpp:110-112
+ auto MBOrErr = MemoryBuffer::getFile(OutputFilename);
+ bool OutputChanged =
+ MBOrErr.getError() || std::move(MBOrErr.get())->getBuffer() != Out.str();
----------------
A variable name like `ExistingOrError` might be better here, and we could probably write it like:
bool OutputChanged = true;
if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename))
OutputChanged = std::move(ExistingOrErr)->getBuffer() != Out.str();
================
Comment at: lib/TableGen/Main.cpp:113
+ MBOrErr.getError() || std::move(MBOrErr.get())->getBuffer() != Out.str();
+ if (!OutputChanged && WriteIfChanged)
+ return 0;
----------------
thakis wrote:
> Not sure if we should even have a --write-if-changed flag instead of doing this unconditionally, since we always pass the flag.
I'm in favor of removing the option and doing this unconditionally.
https://reviews.llvm.org/D45899
More information about the llvm-commits
mailing list