LLVM  10.0.0svn
Classes | Macros | Functions | Variables
WindowsManifestMerger.cpp File Reference
#include "llvm/WindowsManifest/WindowsManifestMerger.h"
#include "llvm/Config/config.h"
#include "llvm/Support/MemoryBuffer.h"
#include <map>
#include <libxml/xmlreader.h>
Include dependency graph for WindowsManifestMerger.cpp:

Go to the source code of this file.

Classes

class  llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl
 

Macros

#define TO_XML_CHAR(X)   reinterpret_cast<const unsigned char *>(X)
 
#define FROM_XML_CHAR(X)   reinterpret_cast<const char *>(X)
 

Functions

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 chargetPrefixForHref (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)
 

Variables

static const std::pair< StringRef, StringRefMtNsHrefsPrefixes []
 

Macro Definition Documentation

◆ FROM_XML_CHAR

#define FROM_XML_CHAR (   X)    reinterpret_cast<const char *>(X)

◆ TO_XML_CHAR

#define TO_XML_CHAR (   X)    reinterpret_cast<const unsigned char *>(X)

Function Documentation

◆ checkAndStripPrefixes()

static void checkAndStripPrefixes ( xmlNodePtr  Node,
std::vector< xmlNsPtr > &  RequiredPrefixes 
)
static

◆ copyAttributeNamespace()

static Error copyAttributeNamespace ( xmlAttrPtr  OriginalAttribute,
xmlNodePtr  OriginalNode,
xmlAttrPtr  AdditionalAttribute 
)
static

◆ explicateNamespace()

static void explicateNamespace ( xmlNsPtr  PrefixDef,
xmlNodePtr  Node 
)
static

Definition at line 310 of file WindowsManifestMerger.cpp.

Referenced by mergeNamespaces().

◆ getAttribute()

static xmlAttrPtr getAttribute ( xmlNodePtr  Node,
const unsigned char AttributeName 
)
static

◆ getChildWithName()

static xmlNodePtr getChildWithName ( xmlNodePtr  Parent,
const unsigned char ElementName 
)
static

Definition at line 88 of file WindowsManifestMerger.cpp.

References xmlStringsEqual().

Referenced by treeMerge().

◆ getClosestDefault()

static xmlNsPtr getClosestDefault ( xmlNodePtr  Node)
static

Definition at line 193 of file WindowsManifestMerger.cpp.

Referenced by mergeAttributes(), and mergeNamespaces().

◆ getDominantNode()

static xmlNodePtr getDominantNode ( xmlNodePtr  Node1,
xmlNodePtr  Node2 
)
static

Definition at line 278 of file WindowsManifestMerger.cpp.

References namespaceOverrides().

Referenced by mergeNamespaces().

◆ getNamespaceWithPrefix()

static xmlNsPtr getNamespaceWithPrefix ( const unsigned char Prefix,
xmlNodePtr  Node 
)
static

Definition at line 178 of file WindowsManifestMerger.cpp.

Referenced by mergeNamespaces().

◆ getPrefixForHref()

static const unsigned char* getPrefixForHref ( const unsigned char HRef)
static

Definition at line 140 of file WindowsManifestMerger.cpp.

References MtNsHrefsPrefixes, TO_XML_CHAR, and xmlStringsEqual().

◆ hasDefinedDefaultNamespace()

static bool hasDefinedDefaultNamespace ( xmlNodePtr  Node)
static

Definition at line 301 of file WindowsManifestMerger.cpp.

Referenced by mergeNamespaces().

◆ hasInheritedDefaultNs()

static bool hasInheritedDefaultNs ( xmlNodePtr  Node)
static

Definition at line 296 of file WindowsManifestMerger.cpp.

◆ hasInheritedNs()

static bool hasInheritedNs ( xmlNodePtr  Node)
static

Definition at line 290 of file WindowsManifestMerger.cpp.

◆ hasRecognizedNamespace()

static bool hasRecognizedNamespace ( xmlNodePtr  Node)
static

◆ isMergeableElement()

static bool isMergeableElement ( const unsigned char ElementName)
static

◆ isRecognizedNamespace()

static bool isRecognizedNamespace ( const unsigned char NsHref)
static

Definition at line 473 of file WindowsManifestMerger.cpp.

References MtNsHrefsPrefixes, TO_XML_CHAR, and xmlStringsEqual().

◆ mergeAttributes()

static Error mergeAttributes ( xmlNodePtr  OriginalNode,
xmlNodePtr  AdditionalNode 
)
static

◆ mergeNamespaces()

static Error mergeNamespaces ( xmlNodePtr  OriginalNode,
xmlNodePtr  AdditionalNode 
)
static

◆ namespaceOverrides()

static bool namespaceOverrides ( const unsigned char HRef1,
const unsigned char HRef2 
)
static

◆ reconcileNamespaces()

static Error reconcileNamespaces ( xmlNodePtr  Node)
static

Definition at line 488 of file WindowsManifestMerger.cpp.

Referenced by treeMerge().

◆ search()

static xmlNsPtr search ( const unsigned char HRef,
xmlNodePtr  Node 
)
static

Definition at line 126 of file WindowsManifestMerger.cpp.

◆ searchOrDefine()

static Expected<xmlNsPtr> searchOrDefine ( const unsigned char HRef,
xmlNodePtr  Node 
)
static

◆ setAttributeNamespaces()

static void setAttributeNamespaces ( xmlNodePtr  Node)
static

◆ stripComments()

static void stripComments ( xmlNodePtr  Root)
static

◆ treeMerge()

static Error treeMerge ( xmlNodePtr  OriginalRoot,
xmlNodePtr  AdditionalRoot 
)
static

◆ xmlStringsEqual()

static bool xmlStringsEqual ( const unsigned char A,
const unsigned char B 
)
static

Variable Documentation

◆ MtNsHrefsPrefixes

const std::pair<StringRef, StringRef> MtNsHrefsPrefixes[]
static
Initial value:
= {
{"urn:schemas-microsoft-com:asm.v1", "ms_asmv1"},
{"urn:schemas-microsoft-com:asm.v2", "ms_asmv2"},
{"urn:schemas-microsoft-com:asm.v3", "ms_asmv3"},
{"http://schemas.microsoft.com/SMI/2005/WindowsSettings",
"ms_windowsSettings"},
{"urn:schemas-microsoft-com:compatibility.v1", "ms_compatibilityv1"}}

Definition at line 61 of file WindowsManifestMerger.cpp.

Referenced by getPrefixForHref(), isRecognizedNamespace(), and namespaceOverrides().