[ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.

The new method name/behavior more closely models the way it was being used.
It also fixes an assertion that can occur when using the new ORC Core APIs,
where flags alone don't necessarily provide enough context to decide whether
the caller is responsible for materializing a given symbol (which was always
the reason this API existed).

The default implementation of getResponsibilitySet uses lookupFlags to determine
responsibility as before, so existing JITSymbolResolvers should continue to
work.

llvm-svn: 340874
diff --git a/llvm/test/ExecutionEngine/OrcLazy/weak-non-materialization.ll b/llvm/test/ExecutionEngine/OrcLazy/weak-non-materialization.ll
new file mode 100644
index 0000000..c20de81
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcLazy/weak-non-materialization.ll
@@ -0,0 +1,17 @@
+; RUN: llc -filetype=obj -o %t1.o %p/Inputs/obj-weak-non-materialization-1.ll
+; RUN: llc -filetype=obj -o %t2.o %p/Inputs/obj-weak-non-materialization-2.ll
+; RUN: lli -jit-kind=orc-lazy -extra-object %t1.o -extra-object %t2.o %s
+;
+; Check that %t1.o's version of the weak symbol X is used, even though %t2.o is
+; materialized first.
+
+@X = external global i32
+
+declare void @foo()
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+  call void @foo()
+  %0 = load i32, i32* @X
+  ret i32 %0
+}