aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AllClangUnitTests.cpp
blob: 6f33230a617c1ca1ea36eaf58a518be8cac0c32a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//===- clang/unittests/AllClangUnitTests.cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/TargetSelect.h"

namespace {
struct RegisterAllLLVMTargets {
  RegisterAllLLVMTargets();
} gv;
} // namespace

// This dynamic initializer initializes all layers (TargetInfo, MC, CodeGen,
// AsmPrinter, etc) of all LLVM targets. This matches what cc1_main does on
// startup, and prevents tests from initializing some of the Target layers,
// which can interfere with tests that assume that lower target layers are
// registered if the TargetInfo is registered.
RegisterAllLLVMTargets::RegisterAllLLVMTargets() {
  llvm::InitializeAllTargetInfos();
  llvm::InitializeAllTargets();
  llvm::InitializeAllTargetMCs();
  llvm::InitializeAllAsmPrinters();
  llvm::InitializeAllAsmParsers();
}