[clang] Add test for CWG190 "Layout-compatible POD-struct types" (#121668)
[llvm-project.git] / llvm / lib / SandboxIR / Module.cpp
blob61cc2414c45ae3cd5a125855dc088c18fe20d2fb
1 //===- Module.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 //===----------------------------------------------------------------------===//
9 #include "llvm/SandboxIR/Module.h"
10 #include "llvm/SandboxIR/Constant.h"
11 #include "llvm/SandboxIR/Context.h"
12 #include "llvm/SandboxIR/Function.h"
13 #include "llvm/SandboxIR/Value.h"
15 using namespace llvm::sandboxir;
17 Function *Module::getFunction(StringRef Name) const {
18 llvm::Function *LLVMF = LLVMM.getFunction(Name);
19 return cast_or_null<Function>(Ctx.getValue(LLVMF));
22 GlobalVariable *Module::getGlobalVariable(StringRef Name,
23 bool AllowInternal) const {
24 return cast_or_null<GlobalVariable>(
25 Ctx.getValue(LLVMM.getGlobalVariable(Name, AllowInternal)));
28 GlobalAlias *Module::getNamedAlias(StringRef Name) const {
29 return cast_or_null<GlobalAlias>(Ctx.getValue(LLVMM.getNamedAlias(Name)));
32 GlobalIFunc *Module::getNamedIFunc(StringRef Name) const {
33 return cast_or_null<GlobalIFunc>(Ctx.getValue(LLVMM.getNamedIFunc(Name)));
36 #ifndef NDEBUG
37 void Module::dumpOS(raw_ostream &OS) const { OS << LLVMM; }
39 void Module::dump() const {
40 dumpOS(dbgs());
41 dbgs() << "\n";
43 #endif // NDEBUG