forked from facebook/redex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDexCallSite.cpp
55 lines (48 loc) · 1.67 KB
/
DexCallSite.cpp
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
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "DexCallSite.h"
#include "DexAnnotation.h"
#include "DexClass.h"
#include "DexIdx.h"
#include "DexMethodHandle.h"
#include <sstream>
void DexCallSite::gather_strings(std::vector<DexString*>& lstring) const {
lstring.emplace_back(m_linker_method_name);
m_linker_method_type->gather_strings(lstring);
for (auto ev : m_linker_method_args) {
ev->gather_strings(lstring);
}
}
void DexCallSite::gather_methodhandles(
std::vector<DexMethodHandle*>& lmethodhandle) const {
lmethodhandle.push_back(m_linker_method_handle);
for (auto ev : m_linker_method_args) {
ev->gather_methodhandles(lmethodhandle);
}
}
void DexCallSite::gather_methods(std::vector<DexMethodRef*>& lmethod) const {
m_linker_method_handle->gather_methods(lmethod);
for (auto ev : m_linker_method_args) {
ev->gather_methods(lmethod);
}
}
void DexCallSite::gather_fields(std::vector<DexFieldRef*>& lfield) const {
m_linker_method_handle->gather_fields(lfield);
for (auto ev : m_linker_method_args) {
ev->gather_fields(lfield);
}
}
DexEncodedValueArray DexCallSite::as_encoded_value_array() const {
auto aev = std::make_unique<std::deque<DexEncodedValue*>>();
for (auto arg : m_linker_method_args) {
aev->push_back(arg);
}
aev->push_front(new DexEncodedValueMethodType(m_linker_method_type));
aev->push_front(new DexEncodedValueString(m_linker_method_name));
aev->push_front(new DexEncodedValueMethodHandle(m_linker_method_handle));
return DexEncodedValueArray(aev.release(), true);
}