clang 23.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
24 return asTuple() == Other.asTuple();
25}
26
28 return !(*this == Other);
29}
30
32 return asTuple() < Other.asTuple();
33}
34
36NestedBuildNamespace::makeCompilationUnit(llvm::StringRef CompilationId) {
38 Result.Namespaces.push_back(
40 return Result;
41}
42
43bool NestedBuildNamespace::empty() const { return Namespaces.empty(); }
44
46 return Namespaces == Other.Namespaces;
47}
48
50 return !(*this == Other);
51}
52
54 return Namespaces < Other.Namespaces;
55}
56
57llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, BuildNamespaceKind BNK) {
58 return OS << buildNamespaceKindToString(BNK);
59}
60
61llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const BuildNamespace &BN) {
62 return OS << "BuildNamespace(" << BN.Kind << ", " << BN.Name << ")";
63}
64
65llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
66 const NestedBuildNamespace &NBN) {
67 OS << "NestedBuildNamespace([";
68 llvm::interleaveComma(NBN.Namespaces, OS);
69 OS << "])";
70 return OS;
71}
72
73} // 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
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:905
@ Other
Other implicit parameter.
Definition Decl.h:1746