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
26/// Represents a multi-architecture static library.
27///
28/// A MultiArchStaticLibrary bundles per-architecture StaticLibrary members. All
29/// members represent the same logical library built for different
30/// architectures; the wrapper's \c Namespace identifies that shared library and
31/// every member's namespace must agree on its name.
33 friend class SerializationFormat;
34 friend class TestFixture;
35
36 /// Orders members by their TargetTriple's canonical enum components.
37 struct MemberByTargetTriple {
38 static auto key(const llvm::Triple &T) {
39 return std::make_tuple(T.getArch(), T.getSubArch(), T.getVendor(),
40 T.getOS(), T.getEnvironment(),
41 T.getObjectFormat());
42 }
43 bool operator()(const std::unique_ptr<StaticLibrary> &A,
44 const std::unique_ptr<StaticLibrary> &B) const {
45 return key(A->TargetTriple) < key(B->TargetTriple);
46 }
47 };
48
49 // The namespace identifying this multi-architecture library. Every member's
50 // Namespace must equal this Namespace.
51 BuildNamespace Namespace;
52
53 // StaticLibrary objects ordered by TargetTriple enum components. Two
54 // members with the same TargetTriple are not permitted.
55 std::set<std::unique_ptr<StaticLibrary>, MemberByTargetTriple> Members;
56
57public:
59 : Namespace(std::move(Namespace)) {}
60};
61
62} // namespace clang::ssaf
63
64#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_ENTITYLINKER_MULTIARCHSTATICLIBRARY_H
Represents a single namespace in the build process.
MultiArchStaticLibrary(BuildNamespace Namespace)