LLVM  8.0.1
COM.inc
Go to the documentation of this file.
1 //==- llvm/Support/Windows/COM.inc - Windows COM Implementation -*- 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 implements the Windows portion of COM support.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 //===----------------------------------------------------------------------===//
15 //=== WARNING: Implementation here must contain only Windows code.
16 //===----------------------------------------------------------------------===//
17 
18 #include <objbase.h>
19 
20 namespace llvm {
21 namespace sys {
22 
24  bool SpeedOverMemory) {
25  DWORD Coinit = 0;
26  if (Threading == COMThreadingMode::SingleThreaded)
27  Coinit |= COINIT_APARTMENTTHREADED;
28  else
29  Coinit |= COINIT_MULTITHREADED;
30  if (SpeedOverMemory)
31  Coinit |= COINIT_SPEED_OVER_MEMORY;
32  ::CoInitializeEx(nullptr, Coinit);
33 }
34 
35 InitializeCOMRAII::~InitializeCOMRAII() { ::CoUninitialize(); }
36 }
37 }
InitializeCOMRAII(COMThreadingMode Threading, bool SpeedOverMemory=false)
This class represents lattice values for constants.
Definition: AllocatorList.h:24
COMThreadingMode
Definition: COM.h:21
jump Jump Threading