Jlm
Linkage.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_IR_LINKAGE_HPP
7 #define JLM_LLVM_IR_LINKAGE_HPP
8 
9 #include <string_view>
10 
11 namespace jlm::llvm
12 {
13 
18 enum class Linkage
19 {
27  // internal symbols are only included in the module's own local symbol table.
29  // private linkage is excluded from all symbol tables.
33 };
34 
43 [[nodiscard]] inline bool
45 {
46  switch (linkage)
47  {
53  return true;
54  default:
55  return false;
56  }
57 }
58 
64 [[nodiscard]] inline bool
66 {
67  return linkage == Linkage::privateLinkage || linkage == Linkage::internalLinkage;
68 }
69 
70 [[nodiscard]] std::string_view
71 linkageToString(Linkage linkage);
72 
73 [[nodiscard]] Linkage
74 linkageFromString(std::string_view stringValue);
75 }
76 
77 #endif
Global memory state passed between functions.
bool isDiscardableIfUnused(const Linkage linkage)
Definition: Linkage.hpp:44
std::string_view linkageToString(const Linkage linkage)
Definition: Linkage.cpp:17
bool isPrivateOrInternal(const Linkage linkage)
Definition: Linkage.hpp:65
Linkage linkageFromString(const std::string_view stringValue)
Definition: Linkage.cpp:42