LLVM  14.0.0git
Symbol.cpp
Go to the documentation of this file.
1 //===- Symbol.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 //
9 // Implements the Symbol.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/TextAPI/Symbol.h"
14 #include <string>
15 
16 namespace llvm {
17 namespace MachO {
18 
19 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
21  std::string Result;
22  if (isUndefined())
23  Result += "(undef) ";
24  if (isWeakDefined())
25  Result += "(weak-def) ";
26  if (isWeakReferenced())
27  Result += "(weak-ref) ";
28  if (isThreadLocalValue())
29  Result += "(tlv) ";
30  switch (Kind) {
32  Result += Name.str();
33  break;
35  Result += "(ObjC Class) " + Name.str();
36  break;
38  Result += "(ObjC Class EH) " + Name.str();
39  break;
41  Result += "(ObjC IVar) " + Name.str();
42  break;
43  }
44  OS << Result;
45 }
46 #endif
47 
49 Symbol::targets(ArchitectureSet Architectures) const {
50  std::function<bool(const Target &)> FN =
51  [Architectures](const Target &Target) {
52  return Architectures.has(Target.Arch);
53  };
54  return make_filter_range(Targets, FN);
55 }
56 
57 } // end namespace MachO.
58 } // end namespace llvm.
llvm::MachO::Target::Arch
Architecture Arch
Definition: Target.h:36
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:491
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MachO::Target
Definition: Target.h:24
llvm::MachO::Symbol::isWeakDefined
bool isWeakDefined() const
Definition: Symbol.h:76
llvm::AMDGPU::Exp::Target
Target
Definition: SIDefines.h:739
llvm::MachO::SymbolKind::GlobalSymbol
@ GlobalSymbol
llvm::MachO::ArchitectureSet::has
bool has(Architecture Arch) const
Definition: ArchitectureSet.h:51
llvm::MachO::SymbolKind::ObjectiveCClass
@ ObjectiveCClass
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::StringRef::str
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:245
llvm::MachO::ArchitectureSet
Definition: ArchitectureSet.h:29
llvm::MachO::SymbolKind::ObjectiveCInstanceVariable
@ ObjectiveCInstanceVariable
llvm::MachO::Symbol::isWeakReferenced
bool isWeakReferenced() const
Definition: Symbol.h:80
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
Symbol.h
llvm::make_filter_range
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
Definition: STLExtras.h:486
llvm::MachO::Symbol::targets
const_target_range targets() const
Definition: Symbol.h:99
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::MachO::SymbolKind::ObjectiveCClassEHType
@ ObjectiveCClassEHType
llvm::MachO::Symbol::isThreadLocalValue
bool isThreadLocalValue() const
Definition: Symbol.h:84
llvm::MachO::Symbol::isUndefined
bool isUndefined() const
Definition: Symbol.h:89
llvm::MachO::Symbol::dump
void dump() const
Definition: Symbol.h:110