/usr/include/llvm-3.9/llvm/ExecutionEngine/JITSymbolFlags.h is in llvm-3.9-dev 1:3.9.1-19ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | //===------ JITSymbolFlags.h - Flags for symbols in the JIT -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Symbol flags for symbols in the JIT (e.g. weak, exported).
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_EXECUTIONENGINE_JITSYMBOLFLAGS_H
#define LLVM_EXECUTIONENGINE_JITSYMBOLFLAGS_H
#include "llvm/IR/GlobalValue.h"
#include "llvm/Object/SymbolicFile.h"
namespace llvm {
/// @brief Flags for symbols in the JIT.
enum class JITSymbolFlags : char {
None = 0,
Weak = 1U << 0,
Exported = 1U << 1
};
inline JITSymbolFlags operator|(JITSymbolFlags LHS, JITSymbolFlags RHS) {
typedef std::underlying_type<JITSymbolFlags>::type UT;
return static_cast<JITSymbolFlags>(
static_cast<UT>(LHS) | static_cast<UT>(RHS));
}
inline JITSymbolFlags& operator |=(JITSymbolFlags &LHS, JITSymbolFlags RHS) {
LHS = LHS | RHS;
return LHS;
}
inline JITSymbolFlags operator&(JITSymbolFlags LHS, JITSymbolFlags RHS) {
typedef std::underlying_type<JITSymbolFlags>::type UT;
return static_cast<JITSymbolFlags>(
static_cast<UT>(LHS) & static_cast<UT>(RHS));
}
inline JITSymbolFlags& operator &=(JITSymbolFlags &LHS, JITSymbolFlags RHS) {
LHS = LHS & RHS;
return LHS;
}
/// @brief Base class for symbols in the JIT.
class JITSymbolBase {
public:
JITSymbolBase(JITSymbolFlags Flags) : Flags(Flags) {}
JITSymbolFlags getFlags() const { return Flags; }
bool isWeak() const {
return (Flags & JITSymbolFlags::Weak) == JITSymbolFlags::Weak;
}
bool isExported() const {
return (Flags & JITSymbolFlags::Exported) == JITSymbolFlags::Exported;
}
static JITSymbolFlags flagsFromGlobalValue(const GlobalValue &GV) {
JITSymbolFlags Flags = JITSymbolFlags::None;
if (GV.hasWeakLinkage())
Flags |= JITSymbolFlags::Weak;
if (!GV.hasLocalLinkage() && !GV.hasHiddenVisibility())
Flags |= JITSymbolFlags::Exported;
return Flags;
}
static JITSymbolFlags
flagsFromObjectSymbol(const object::BasicSymbolRef &Symbol) {
JITSymbolFlags Flags = JITSymbolFlags::None;
if (Symbol.getFlags() & object::BasicSymbolRef::SF_Weak)
Flags |= JITSymbolFlags::Weak;
if (Symbol.getFlags() & object::BasicSymbolRef::SF_Exported)
Flags |= JITSymbolFlags::Exported;
return Flags;
}
private:
JITSymbolFlags Flags;
};
} // end namespace llvm
#endif
|