clang 24.0.0git
MultiArchStaticLibrary.h
Go to the documentation of this file.
1//===- MultiArchStaticLibrary.h ---------------------------------*- C++ -*-===//
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// This file defines the MultiArchStaticLibrary class, which represents a
10// multi-architecture wrapper around per-architecture StaticLibrary
11// instances.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_ENTITYLINKER_MULTIARCHSTATICLIBRARY_H
16#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_ENTITYLINKER_MULTIARCHSTATICLIBRARY_H
17
20#include <memory>
21#include <set>
22#include <tuple>
23
24namespace clang::ssaf {
25
26class MultiArchCreateCLI;
27
28/// Represents a multi-architecture static library.
29///
30/// A MultiArchStaticLibrary bundles per-architecture StaticLibrary members. All
31/// members represent the same logical library built for different
32/// architectures; the wrapper's \c Namespace identifies that shared library and
33/// every member's namespace must agree on its name.
35 friend class MultiArchCreateCLI;
36 friend class SerializationFormat;
37 friend class TestFixture;
38
39 /// Orders members by their TargetTriple's canonical enum components.
40 struct MemberByTargetTriple {
41 static auto key(const llvm::Triple &T) {
42 return std::make_tuple(T.getArch(), T.getSubArch(), T.getVendor(),
43 T.getOS(), T.getEnvironment(),
44 T.getObjectFormat());
45 }
46 bool operator()(const std::unique_ptr<StaticLibrary> &A,
47 const std::unique_ptr<StaticLibrary> &B) const {
48 return key(A->TargetTriple) < key(B->TargetTriple);
49 }
50 };
51
52 // The namespace identifying this multi-architecture library. Every member's
53 // Namespace must equal this Namespace.
54 BuildNamespace Namespace;
55
56 // StaticLibrary objects ordered by TargetTriple enum components. Two
57 // members with the same TargetTriple are not permitted.
58 std::set<std::unique_ptr<StaticLibrary>, MemberByTargetTriple> Members;
59
60public:
62 : Namespace(std::move(Namespace)) {}
63};
64
65} // namespace clang::ssaf
66
67#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_ENTITYLINKER_MULTIARCHSTATICLIBRARY_H
Represents a single namespace in the build process.
MultiArchStaticLibrary(BuildNamespace Namespace)
const FunctionProtoType * T