clang 24.0.0git
BuildNamespace.cpp
Go to the documentation of this file.
1//===- BuildNamespace.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
11#include "llvm/ADT/STLExtras.h"
12#include "llvm/Support/ErrorHandling.h"
13#include <tuple>
14
15namespace clang::ssaf {
16
18BuildNamespace::makeCompilationUnit(llvm::StringRef CompilationId) {
20 CompilationId.str()};
21}
22
26
28 return asTuple() == Other.asTuple();
29}
30
32 return !(*this == Other);
33}
34
36 return asTuple() < Other.asTuple();
37}
38
40NestedBuildNamespace::makeCompilationUnit(llvm::StringRef CompilationId) {
42 Result.Namespaces.push_back(
44 return Result;
45}
46
47bool NestedBuildNamespace::empty() const { return Namespaces.empty(); }
48
50 return Namespaces == Other.Namespaces;
51}
52
54 return !(*this == Other);
55}
56
58 return Namespaces < Other.Namespaces;
59}
60
61llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, BuildNamespaceKind BNK) {
62 return OS << buildNamespaceKindToString(BNK);
63}
64
65llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const BuildNamespace &BN) {
66 return OS << "BuildNamespace(" << BN.Kind << ", " << BN.Name << ")";
67}
68
69llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
70 const NestedBuildNamespace &NBN) {
71 OS << "NestedBuildNamespace([";
72 llvm::interleaveComma(NBN.Namespaces, OS);
73 OS << "])";
74 return OS;
75}
76
77} // namespace clang::ssaf
Represents a single namespace in the build process.
BuildNamespace(BuildNamespaceKind Kind, llvm::StringRef Name)
bool operator<(const BuildNamespace &Other) const
bool operator!=(const BuildNamespace &Other) const
static BuildNamespace makeCompilationUnit(llvm::StringRef CompilationId)
Creates a BuildNamespace representing a compilation unit.
bool operator==(const BuildNamespace &Other) const
BuildNamespace withKind(BuildNamespaceKind Kind) const
Returns a copy of this namespace with its kind replaced by Kind, preserving the name.
Represents a hierarchical sequence of build namespaces.
static NestedBuildNamespace makeCompilationUnit(llvm::StringRef CompilationId)
Creates a NestedBuildNamespace representing a compilation unit.
bool operator<(const NestedBuildNamespace &Other) const
bool operator!=(const NestedBuildNamespace &Other) const
bool operator==(const NestedBuildNamespace &Other) const
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, BuildNamespaceKind BNK)
llvm::StringRef buildNamespaceKindToString(BuildNamespaceKind BNK)
Returns the canonical string representation of BNK used for serialization and display (e....
@ Result
The result type of a method or function.
Definition TypeBase.h:906
@ Other
Other implicit parameter.
Definition Decl.h:1774