Implement parsing and writing of a single xml manifest file.
Details
Diff Detail
- Build Status
Buildable 8239 Build 8239: arc lint + arc unit
Event Timeline
| llvm/cmake/config-ix.cmake | ||
|---|---|---|
| 604 | Does it make sense to not do this on Windows? | |
| llvm/include/llvm/Support/WindowsManifestMerger.h | ||
| 33 | You can use #ifdef | |
| 52 | const Twine &Msg? | |
| llvm/lib/Support/WindowsManifestMerger.cpp | ||
| 29 | Use #ifdef throughout this patch. | |
| 42 | This function returns something non-empty even if you dont' have libxml2, but I don't think that makes sense. Just like above function which just returns Error::success(), I think it is better to return {} from this function if libxml is not available. | |
| 42 | Looks like it is more straightforward to return an std::vector<uint8_t> from this function instead of a MemoryBuffer. MemoryBuffer is usually used to represent something you've read from files. In this case, this function just construct an in-memory data structure which can easily be represented as std::vector. | |
| llvm/test/CMakeLists.txt | ||
| 60–61 | Is this intentional? | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
| 68 | Remove a full stop. | |
| 77–79 | nit: since the real function body is just one line, this is simpler if (EC) reportError | |
| 83–87 | Ditto | |
| 110 | Remove a full stop and \n. Error messages should start with lowercase letter. | |
| 122 | Ditto | |
| 129 | Ditto | |
| 133 | Ditto | |
| 149 | Ditto | |
Rebase
| llvm/cmake/config-ix.cmake | ||
|---|---|---|
| 604 | Yes, apparently the version of libxml2 on Windows uses different headers than what we expect and linking it in would cause a problem. Besides, if we are on windows we can just continue to shell out to the original mt.exe tool. | |
| llvm/lib/Support/WindowsManifestMerger.cpp | ||
| 42 | In this case I feel it is more convenient to use MemoryBuffer because it directly takes ownership of the underlying data allocated by xmlDocDumpMemory(). For using a vector we would need an additional copy, and then explicitly delete the allocated memory. Though perhaps this is okay for clarity? | |
| llvm/test/CMakeLists.txt | ||
| 60–61 | Yes down below I only add the test depends if libxml2 is found. | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
| 68 | When I rebase the previous patch these mistakes will go away. | |
| llvm/include/llvm/Support/WindowsManifestMerger.h | ||
|---|---|---|
| 29 | This include guard is not correct. #endif should be at end of the file. | |
| 61–62 | Do you need this? Since you didn't define any other ctors, this is defined as a default ctor. Isn't it enough? | |
| llvm/lib/Support/WindowsManifestMerger.cpp | ||
| 43–46 | I think you'll get a compiler warning if you compile it in an environment that doesn't have libxml, as BufferSize and XmlBuff will be unused. A better way of doing it is to completely separate two conditions: std::unique_ptr<MemoryBuffer> WindowsManifestMerger::getMergedManifest() {
#ifdef LIBXML2_ENABLED
...
return OutputBuffer;
#else
return nullptr;
#endif
} | |
| 69 | Remove else after return. | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
| 78 | Indentation. | |
| 83 | Indentation. | |
| llvm/include/llvm/Support/WindowsManifestMerger.h | ||
|---|---|---|
| 75 | Fix this. (It doesn't say that you need a blank line at end of a file, but it says that your last line doesn't end with '\n'.) | |
| llvm/lib/Support/WindowsManifestMerger.cpp | ||
| 52–55 | You can eliminate OutputBuffer by doing this: if (BufferSize == 0)
return nullptr;
return MemoryBuffer::getMemBuffer(
StringRef(reinterpret_cast<const char *>(XmlBuff), (size_t)BufferSize)); | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
| 146 | Isn't this an error? Looks like this program exits with 0 in this case. | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
|---|---|---|
| 146 | check most recent patch. | |
| llvm/tools/llvm-mt/llvm-mt.cpp | ||
|---|---|---|
| 147 | Since reportError is a noreturn function, remove else. | |
WindowsManifestMerger.h should not include llvm/Config/config.h: https://bugs.llvm.org/show_bug.cgi?id=34608
Does it make sense to not do this on Windows?