Implement parsing and writing of a single xml manifest file.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/cmake/config-ix.cmake | ||
---|---|---|
604 ↗ | (On Diff #106733) | Does it make sense to not do this on Windows? |
llvm/include/llvm/Support/WindowsManifestMerger.h | ||
32 ↗ | (On Diff #106733) | You can use #ifdef |
51 ↗ | (On Diff #106733) | const Twine &Msg? |
llvm/lib/Support/WindowsManifestMerger.cpp | ||
28 ↗ | (On Diff #106733) | Use #ifdef throughout this patch. |
41 ↗ | (On Diff #106733) | 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. |
41 ↗ | (On Diff #106733) | 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 | ||
61 ↗ | (On Diff #106733) | Is this intentional? |
llvm/tools/llvm-mt/llvm-mt.cpp | ||
68 ↗ | (On Diff #106733) | Remove a full stop. |
77–79 ↗ | (On Diff #106733) | nit: since the real function body is just one line, this is simpler if (EC) reportError |
83–87 ↗ | (On Diff #106733) | Ditto |
110 ↗ | (On Diff #106733) | Remove a full stop and \n. Error messages should start with lowercase letter. |
122 ↗ | (On Diff #106733) | Ditto |
129 ↗ | (On Diff #106733) | Ditto |
133 ↗ | (On Diff #106733) | Ditto |
149 ↗ | (On Diff #106733) | Ditto |
Rebase
llvm/cmake/config-ix.cmake | ||
---|---|---|
604 ↗ | (On Diff #106733) | 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 | ||
41 ↗ | (On Diff #106733) | 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 | ||
61 ↗ | (On Diff #106733) | Yes down below I only add the test depends if libxml2 is found. |
llvm/tools/llvm-mt/llvm-mt.cpp | ||
68 ↗ | (On Diff #106733) | When I rebase the previous patch these mistakes will go away. |
llvm/include/llvm/Support/WindowsManifestMerger.h | ||
---|---|---|
28 ↗ | (On Diff #107188) | This include guard is not correct. #endif should be at end of the file. |
60–61 ↗ | (On Diff #107188) | 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 | ||
42–45 ↗ | (On Diff #107188) | 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 } |
68 ↗ | (On Diff #107188) | Remove else after return. |
llvm/tools/llvm-mt/llvm-mt.cpp | ||
78 ↗ | (On Diff #107188) | Indentation. |
83 ↗ | (On Diff #107188) | Indentation. |
llvm/include/llvm/Support/WindowsManifestMerger.h | ||
---|---|---|
76 ↗ | (On Diff #107351) | 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 | ||
51–54 ↗ | (On Diff #107351) | 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 ↗ | (On Diff #107351) | Isn't this an error? Looks like this program exits with 0 in this case. |
llvm/tools/llvm-mt/llvm-mt.cpp | ||
---|---|---|
146 ↗ | (On Diff #107351) | check most recent patch. |
llvm/tools/llvm-mt/llvm-mt.cpp | ||
---|---|---|
147 ↗ | (On Diff #107383) | 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