1//===- clang/unittests/AllClangUnitTests.cpp ------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/Support/TargetSelect.h"
10
11namespace {
12struct RegisterAllLLVMTargets {
13 RegisterAllLLVMTargets();
14} gv;
15} // namespace
16
17// This dynamic initializer initializes all layers (TargetInfo, MC, CodeGen,
18// AsmPrinter, etc) of all LLVM targets. This matches what cc1_main does on
19// startup, and prevents tests from initializing some of the Target layers,
20// which can interfere with tests that assume that lower target layers are
21// registered if the TargetInfo is registered.
22RegisterAllLLVMTargets::RegisterAllLLVMTargets() {
23 llvm::InitializeAllTargetInfos();
24 llvm::InitializeAllTargets();
25 llvm::InitializeAllTargetMCs();
26 llvm::InitializeAllAsmPrinters();
27 llvm::InitializeAllAsmParsers();
28}
29

source code of clang/unittests/AllClangUnitTests.cpp