LLVM  6.0.0svn
WindowsManifestMerger.h
Go to the documentation of this file.
1 //===-- WindowsManifestMerger.h ---------------------------------*- C++-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===---------------------------------------------------------------------===//
9 //
10 // This file provides a utility for merging Microsoft .manifest files. These
11 // files are xml documents which contain meta-information about applications,
12 // such as whether or not admin access is required, system compatibility,
13 // versions, etc. Part of the linking process of an executable may require
14 // merging several of these .manifest files using a tree-merge following
15 // specific rules. Unfortunately, these rules are not documented well
16 // anywhere. However, a careful investigation of the behavior of the original
17 // Microsoft Manifest Tool (mt.exe) revealed the rules of this merge. As the
18 // saying goes, code is the best documentation, so please look below if you are
19 // interested in the exact merging requirements.
20 //
21 // Ref:
22 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa374191(v=vs.85).aspx
23 //
24 //===---------------------------------------------------------------------===//
25 
26 #ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_MANIFEST_MERGER_H
27 #define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_MANIFEST_MERGER_H
28 
29 #include "llvm/Support/Error.h"
30 
31 namespace llvm {
32 
33 class MemoryBuffer;
34 
35 namespace windows_manifest {
36 
37 bool isAvailable();
38 
39 class WindowsManifestError : public ErrorInfo<WindowsManifestError, ECError> {
40 public:
41  static char ID;
42  WindowsManifestError(const Twine &Msg);
43  void log(raw_ostream &OS) const override;
44 
45 private:
46  std::string Msg;
47 };
48 
50 public:
53  Error merge(const MemoryBuffer &Manifest);
54 
55  // Returns vector containing merged xml manifest, or uninitialized vector for
56  // empty manifest.
57  std::unique_ptr<MemoryBuffer> getMergedManifest();
58 
59 private:
61  std::unique_ptr<WindowsManifestMergerImpl> Impl;
62 };
63 
64 } // namespace windows_manifest
65 } // namespace llvm
66 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
void log(raw_ostream &OS) const override
Print an error message to an output stream.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:40
Base class for user error types.
Definition: Error.h:331
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44