#include "llvm/WindowsManifest/WindowsManifestMerger.h"
#include "llvm/Config/config.h"
#include "llvm/Support/MemoryBuffer.h"
#if LLVM_ENABLE_LIBXML2
#include <libxml/xmlreader.h>
#endif
#define TO_XML_CHAR(X) …
#define FROM_XML_CHAR(X) …
usingnamespacellvm;
usingnamespacewindows_manifest;
char WindowsManifestError::ID = …;
WindowsManifestError::WindowsManifestError(const Twine &Msg) : … { … }
void WindowsManifestError::log(raw_ostream &OS) const { … }
class WindowsManifestMerger::WindowsManifestMergerImpl { … };
#if LLVM_ENABLE_LIBXML2
static constexpr std::pair<StringLiteral, StringLiteral> MtNsHrefsPrefixes[] = …;
static bool xmlStringsEqual(const unsigned char *A, const unsigned char *B) { … }
static bool isMergeableElement(const unsigned char *ElementName) { … }
static xmlNodePtr getChildWithName(xmlNodePtr Parent,
const unsigned char *ElementName) { … }
static xmlAttrPtr getAttribute(xmlNodePtr Node,
const unsigned char *AttributeName) { … }
static bool namespaceOverrides(const unsigned char *HRef1,
const unsigned char *HRef2) { … }
static xmlNsPtr search(const unsigned char *HRef, xmlNodePtr Node) { … }
static const unsigned char *getPrefixForHref(const unsigned char *HRef) { … }
static Expected<xmlNsPtr> searchOrDefine(const unsigned char *HRef,
xmlNodePtr Node) { … }
static Error copyAttributeNamespace(xmlAttrPtr OriginalAttribute,
xmlNodePtr OriginalNode,
xmlAttrPtr AdditionalAttribute) { … }
static xmlNsPtr getNamespaceWithPrefix(const unsigned char *Prefix,
xmlNodePtr Node) { … }
static xmlNsPtr getClosestDefault(xmlNodePtr Node) { … }
static Error mergeAttributes(xmlNodePtr OriginalNode,
xmlNodePtr AdditionalNode) { … }
static xmlNodePtr getDominantNode(xmlNodePtr Node1, xmlNodePtr Node2) { … }
static bool hasInheritedNs(xmlNodePtr Node) { … }
static bool hasInheritedDefaultNs(xmlNodePtr Node) { … }
static bool hasDefinedDefaultNamespace(xmlNodePtr Node) { … }
static void explicateNamespace(xmlNsPtr PrefixDef, xmlNodePtr Node) { … }
static Error mergeNamespaces(xmlNodePtr OriginalNode,
xmlNodePtr AdditionalNode) { … }
static bool isRecognizedNamespace(const unsigned char *NsHref) { … }
static bool hasRecognizedNamespace(xmlNodePtr Node) { … }
static Error reconcileNamespaces(xmlNodePtr Node) { … }
static Error treeMerge(xmlNodePtr OriginalRoot, xmlNodePtr AdditionalRoot) { … }
static void stripComments(xmlNodePtr Root) { … }
static void setAttributeNamespaces(xmlNodePtr Node) { … }
static void checkAndStripPrefixes(xmlNodePtr Node,
std::vector<xmlNsPtr> &RequiredPrefixes) { … }
WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl() { … }
Error WindowsManifestMerger::WindowsManifestMergerImpl::merge(
MemoryBufferRef Manifest) { … }
std::unique_ptr<MemoryBuffer>
WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest() { … }
bool windows_manifest::isAvailable() { … }
#else
WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl() {
}
Error WindowsManifestMerger::WindowsManifestMergerImpl::merge(
MemoryBufferRef Manifest) {
return make_error<WindowsManifestError>("no libxml2");
}
std::unique_ptr<MemoryBuffer>
WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest() {
return nullptr;
}
bool windows_manifest::isAvailable() { return false; }
#endif
WindowsManifestMerger::WindowsManifestMerger()
: … { … }
WindowsManifestMerger::~WindowsManifestMerger() = default;
Error WindowsManifestMerger::merge(MemoryBufferRef Manifest) { … }
std::unique_ptr<MemoryBuffer> WindowsManifestMerger::getMergedManifest() { … }
void WindowsManifestMerger::WindowsManifestMergerImpl::errorCallback(
void *Ctx, const char *Format, ...) { … }
Error WindowsManifestMerger::WindowsManifestMergerImpl::getParseError() { … }