Update clang to r339409b.
Change-Id: Ied8a188bb072c40035320acedc86164b66d920af
diff --git a/linux-x64/clang/include/llvm/ExecutionEngine/JITSymbol.h b/linux-x64/clang/include/llvm/ExecutionEngine/JITSymbol.h
index 0e33f01..18b972e 100644
--- a/linux-x64/clang/include/llvm/ExecutionEngine/JITSymbol.h
+++ b/linux-x64/clang/include/llvm/ExecutionEngine/JITSymbol.h
@@ -23,6 +23,7 @@
#include <set>
#include <string>
+#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
@@ -54,7 +55,8 @@
Exported = 1U << 4,
Callable = 1U << 5,
Lazy = 1U << 6,
- Materializing = 1U << 7
+ Materializing = 1U << 7,
+ LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ Materializing)
};
static JITSymbolFlags stripTransientFlags(JITSymbolFlags Orig) {
@@ -72,6 +74,26 @@
JITSymbolFlags(FlagNames Flags, TargetFlagsType TargetFlags)
: Flags(Flags), TargetFlags(TargetFlags) {}
+ /// Implicitly convert to bool. Returs true if any flag is set.
+ explicit operator bool() const { return Flags != None || TargetFlags != 0; }
+
+ /// Compare for equality.
+ bool operator==(const JITSymbolFlags &RHS) const {
+ return Flags == RHS.Flags && TargetFlags == RHS.TargetFlags;
+ }
+
+ /// Bitwise AND-assignment for FlagNames.
+ JITSymbolFlags &operator&=(const FlagNames &RHS) {
+ Flags &= RHS;
+ return *this;
+ }
+
+ /// Bitwise OR-assignment for FlagNames.
+ JITSymbolFlags &operator|=(const FlagNames &RHS) {
+ Flags |= RHS;
+ return *this;
+ }
+
/// Return true if there was an error retrieving this symbol.
bool hasError() const {
return (Flags & HasError) == HasError;
@@ -113,11 +135,10 @@
/// Returns true if the given symbol is known to be callable.
bool isCallable() const { return (Flags & Callable) == Callable; }
- /// Implicitly convert to the underlying flags type.
- operator UnderlyingType&() { return Flags; }
-
- /// Implicitly convert to the underlying flags type.
- operator const UnderlyingType&() const { return Flags; }
+ /// Get the underlying flags value as an integer.
+ UnderlyingType getRawFlagsValue() const {
+ return static_cast<UnderlyingType>(Flags);
+ }
/// Return a reference to the target-specific flags.
TargetFlagsType& getTargetFlags() { return TargetFlags; }
@@ -135,10 +156,24 @@
fromObjectSymbol(const object::SymbolRef &Symbol);
private:
- UnderlyingType Flags = None;
+ FlagNames Flags = None;
TargetFlagsType TargetFlags = 0;
};
+inline JITSymbolFlags operator&(const JITSymbolFlags &LHS,
+ const JITSymbolFlags::FlagNames &RHS) {
+ JITSymbolFlags Tmp = LHS;
+ Tmp &= RHS;
+ return Tmp;
+}
+
+inline JITSymbolFlags operator|(const JITSymbolFlags &LHS,
+ const JITSymbolFlags::FlagNames &RHS) {
+ JITSymbolFlags Tmp = LHS;
+ Tmp |= RHS;
+ return Tmp;
+}
+
/// ARM-specific JIT symbol flags.
/// FIXME: This should be moved into a target-specific header.
class ARMJITSymbolFlags {
@@ -298,7 +333,7 @@
public:
using LookupSet = std::set<StringRef>;
using LookupResult = std::map<StringRef, JITEvaluatedSymbol>;
- using LookupFlagsResult = std::map<StringRef, JITSymbolFlags>;
+ using OnResolvedFunction = std::function<void(Expected<LookupResult>)>;
virtual ~JITSymbolResolver() = default;
@@ -307,13 +342,14 @@
///
/// This method will return an error if any of the given symbols can not be
/// resolved, or if the resolution process itself triggers an error.
- virtual Expected<LookupResult> lookup(const LookupSet &Symbols) = 0;
+ virtual void lookup(const LookupSet &Symbols,
+ OnResolvedFunction OnResolved) = 0;
- /// Returns the symbol flags for each of the given symbols.
- ///
- /// This method does NOT return an error if any of the given symbols is
- /// missing. Instead, that symbol will be left out of the result map.
- virtual Expected<LookupFlagsResult> lookupFlags(const LookupSet &Symbols) = 0;
+ /// Returns the subset of the given symbols that should be materialized by
+ /// the caller. Only weak/common symbols should be looked up, as strong
+ /// definitions are implicitly always part of the caller's responsibility.
+ virtual Expected<LookupSet>
+ getResponsibilitySet(const LookupSet &Symbols) = 0;
private:
virtual void anchor();
@@ -325,11 +361,11 @@
/// Performs lookup by, for each symbol, first calling
/// findSymbolInLogicalDylib and if that fails calling
/// findSymbol.
- Expected<LookupResult> lookup(const LookupSet &Symbols) final;
+ void lookup(const LookupSet &Symbols, OnResolvedFunction OnResolved) final;
/// Performs flags lookup by calling findSymbolInLogicalDylib and
/// returning the flags value for that symbol.
- Expected<LookupFlagsResult> lookupFlags(const LookupSet &Symbols) final;
+ Expected<LookupSet> getResponsibilitySet(const LookupSet &Symbols) final;
/// This method returns the address of the specified symbol if it exists
/// within the logical dynamic library represented by this JITSymbolResolver.