[abckit] Dev branch

Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IB0NKT

Signed-off-by: ivagin <vagin.ivan1@huawei-partners.com>
This commit is contained in:
ivagin 2024-10-29 14:37:46 +01:00
parent 044121aa1f
commit b6b09de021
228 changed files with 10835 additions and 7311 deletions

View File

@ -43,15 +43,41 @@ static void TransformMethod(AbckitCoreFunction *method)
g_implM->functionSetGraph(method, graph);
}
// CC-OFFNXT(超大函数[C++] Oversized function) huge_function
static void EnumerateAllMethodsInModule(AbckitFile *file, std::function<bool(AbckitCoreNamespace *)> &cbNamespace,
std::function<bool(AbckitCoreClass *)> &cbClass,
std::function<bool(AbckitCoreFunction *)> &cbFunc, bool &hasError)
{
std::function<bool(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreNamespace *)> *>(cb))(n);
});
g_implI->moduleEnumerateClasses(m, &cbClass, [](AbckitCoreClass *c, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreClass *)> *>(cb))(c);
});
g_implI->moduleEnumerateTopLevelFunctions(m, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreFunction *)> *>(cb))(f);
});
return !hasError;
};
g_implI->fileEnumerateModules(file, &cbModule, [](AbckitCoreModule *m, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreModule *)> *>(cb))(m);
});
}
extern "C" int Entry(AbckitFile *file)
{
bool hasError = false;
std::function<bool(AbckitCoreClass *)> cbClass;
std::function<bool(AbckitCoreFunction *)> cbFunc = [&](AbckitCoreFunction *f) {
g_implI->functionEnumerateNestedFunctions(f, &cbFunc, [](AbckitCoreFunction *f, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreFunction *)> *>(cb))(f);
});
g_implI->functionEnumerateNestedClasses(f, &cbClass, [](AbckitCoreClass *c, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreClass *)> *>(cb))(c);
});
TransformMethod(f);
if (g_impl->getLastError() != ABCKIT_STATUS_NO_ERROR) {
@ -61,15 +87,15 @@ extern "C" int Entry(AbckitFile *file)
return !hasError;
};
std::function<bool(AbckitCoreClass *)> cbClass = [&](AbckitCoreClass *c) {
cbClass = [&](AbckitCoreClass *c) {
g_implI->classEnumerateMethods(c, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreFunction *)> *>(cb))(m);
});
return !hasError;
};
std::function<void(AbckitCoreNamespace *)> cbNamespce = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
std::function<bool(AbckitCoreNamespace *)> cbNamespace = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreNamespace *)> *>(cb))(n);
});
g_implI->namespaceEnumerateClasses(n, &cbClass, [](AbckitCoreClass *c, void *cb) {
@ -81,22 +107,7 @@ extern "C" int Entry(AbckitFile *file)
return !hasError;
};
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreNamespace *)> *>(cb))(n);
});
g_implI->moduleEnumerateClasses(m, &cbClass, [](AbckitCoreClass *c, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreClass *)> *>(cb))(c);
});
g_implI->moduleEnumerateTopLevelFunctions(m, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreFunction *)> *>(cb))(m);
});
return !hasError;
};
g_implI->fileEnumerateModules(file, &cbModule, [](AbckitCoreModule *m, void *cb) {
return (*reinterpret_cast<std::function<bool(AbckitCoreModule *)> *>(cb))(m);
});
EnumerateAllMethodsInModule(file, cbNamespace, cbClass, cbFunc, hasError);
return hasError ? 1 : 0;
}

View File

@ -328,9 +328,9 @@ std::function<void(AbckitCoreClass *)> cbClass = [&](AbckitCoreClass *c) {
});
};
std::function<void(AbckitCoreNamespace *)> cbNamespce;
cbNamespce = [&](AbckitCoreNamespace *n) {
implI->namespaceEnumerateNamespaces(n, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
std::function<void(AbckitCoreNamespace *)> cbNamespace;
cbNamespace = [&](AbckitCoreNamespace *n) {
implI->namespaceEnumerateNamespaces(n, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
@ -345,7 +345,7 @@ cbNamespce = [&](AbckitCoreNamespace *n) {
};
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
implI->moduleEnumerateNamespaces(m, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
implI->moduleEnumerateNamespaces(m, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});

View File

@ -445,7 +445,7 @@ struct AbckitArktsDynamicModuleExportCreateParams {
/**
* @brief Struct that is used to create new external modules.
*/
struct AbckitArktsExternalModuleCreateParams {
struct AbckitArktsV1ExternalModuleCreateParams {
/**
* @brief Name of the created external module
*/
@ -461,16 +461,16 @@ struct AbckitArktsModifyApi {
* ======================================== */
/**
* @brief Creates an external Arkts module and adds it to the file `file`.
* @return AbckitArktsModule *.
* @brief Creates an external Arkts module with target `ABCKIT_TARGET_ARK_TS_V1` and adds it to the file `file`.
* @return Pointer to the newly created module.
* @param [ in ] file - Binary file to .
* @param [ in ] params - Data that is used to create the external module.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `file` is NULL.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL.
* @note Allocates
*/
AbckitArktsModule *(*fileAddExternalModule)(AbckitFile *file,
const struct AbckitArktsExternalModuleCreateParams *params);
AbckitArktsModule *(*fileAddExternalModuleArktsV1)(AbckitFile *file,
const struct AbckitArktsV1ExternalModuleCreateParams *params);
/* ========================================
* Module

View File

@ -138,6 +138,14 @@ struct AbckitGraphApi {
*/
AbckitInst *(*gGetParameter)(AbckitGraph *graph, uint32_t index);
/**
* @brief Returns number of instruction parameters under given `graph`.
* @return uint32_t corresponding to number of instruction parameters.
* @param [ in ] graph - Graph to be inspected.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
*/
uint32_t (*gGetNumberOfParameters)(AbckitGraph *graph);
/**
* @brief Wraps basic blocks from `tryFirstBB` to `tryLastBB` into try,
* inserts basic blocks from `catchBeginBB` to `catchEndBB` into graph.
@ -406,7 +414,7 @@ struct AbckitGraphApi {
* @param [ in ] basicBlock - basic block to clear.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
*/
void (*bbClear)(AbckitBasicBlock *basicBlock);
void (*bbRemoveAllInsts)(AbckitBasicBlock *basicBlock);
/**
* @brief Returns first instruction from `basicBlock`.
@ -574,6 +582,17 @@ struct AbckitGraphApi {
*/
AbckitInst *(*bbCreatePhi)(AbckitBasicBlock *basicBlock, size_t argCount, ...);
/**
* @brief Creates CatchPhi instruction and sets it at the beginning of basic block `catchBegin`.
* @return Pointer to created `AbckitInst`.
* @param [ in ] catchBegin - Basic block at the beginning of which the instruction will be inserted.
* @param [ in ] argCount - Number of instruction's inputs
* @param [ in ] ... - Instructions that are inputs of the new instruction.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `catchBegin` is NULL.
* @note Set `ABCKIT_STATUS_WRONG_MODE` error if `graph` is not DYNAMIC.
*/
AbckitInst *(*bbCreateCatchPhi)(AbckitBasicBlock *catchBegin, size_t argCount, ...);
/**
* @brief Removes instruction from it's basic block.
* @return None.

View File

@ -3107,19 +3107,6 @@ struct AbckitIsaApiDynamic {
* @note Set `ABCKIT_STATUS_WRONG_MODE` error if `graph` is not DYNAMIC.
*/
AbckitInst *(*iCreateIf)(AbckitGraph *graph, AbckitInst *input, enum AbckitIsaApiDynamicConditionCode cc);
/**
* @brief Creates CatchPhi instruction and sets it at the beginning of basic block `catchBegin`.
* @return Pointer to created `AbckitInst`.
* @param [ in ] graph - Graph where instruction will be inserted.
* @param [ in ] catchBegin - Basic block at the beginning of which the instruction will be inserted.
* @param [ in ] argCount - Number of instruction's inputs
* @param [ in ] ... - Instructions that are inputs of the new instruction.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `catchBegin` is NULL.
* @note Set `ABCKIT_STATUS_WRONG_MODE` error if `graph` is not DYNAMIC.
*/
AbckitInst *(*iCreateCatchPhi)(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, ...);
};
/**

View File

@ -797,6 +797,14 @@ struct AbckitInspectApi {
*/
AbckitString *(*classGetName)(AbckitCoreClass *klass);
/**
* @brief Returns parent function for class `klass`.
* @return Pointer to the `AbckitCoreFunction`.
* @param [ in ] klass - Class to be inspected.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `klass` is NULL.
*/
AbckitCoreFunction *(*classGetParentFunction)(AbckitCoreClass *klass);
/**
* @brief Returns parent namespace for class `klass`.
* @return Pointer to the `AbckitCoreNamespace`.
@ -860,6 +868,14 @@ struct AbckitInspectApi {
*/
AbckitString *(*functionGetName)(AbckitCoreFunction *function);
/**
* @brief Returns parent function for function `function`.
* @return Pointer to the `AbckitCoreClass`.
* @param [ in ] function - Function to be inspected.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL.
*/
AbckitCoreFunction *(*functionGetParentFunction)(AbckitCoreFunction *function);
/**
* @brief Returns parent class for function `function`.
* @return Pointer to the `AbckitCoreClass`.
@ -889,6 +905,19 @@ struct AbckitInspectApi {
void (*functionEnumerateNestedFunctions)(AbckitCoreFunction *func, void *data,
bool (*cb)(AbckitCoreFunction *nestedFunc, void *data));
/**
* @brief Enumerates nested classes of function `func`, invoking callback `cb` for each nested class.
* @return None.
* @param [ in ] func - Function to be inspected.
* @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
* it is invoked.
* @param [ in ] cb - Callback that will be invoked.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `func` is NULL.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
*/
void (*functionEnumerateNestedClasses)(AbckitCoreFunction *func, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data));
/**
* @brief Enumerates annotations of function `func`, invoking callback `cb` for each annotation.
* @return None.

View File

@ -25,28 +25,28 @@ logging.basicConfig(format='%(message)s', level=logging.DEBUG)
def get_args():
parser = argparse.ArgumentParser(description="Abckit status script")
parser = argparse.ArgumentParser(description='Abckit status script')
parser.add_argument(
"--print-implemented",
action="store_true",
'--print-implemented',
action='store_true',
default=False,
help=f"Print list of implemented API and exit")
help=f'Print list of implemented API and exit')
return parser.parse_args()
args = get_args()
API_PATTERN = "^[\w,\d,_, ,*]+\(\*([\w,\d,_]+)\)\(.*"
domain_patterns = ["struct Abckit\S*Api\s\{", "struct Abckit\S*ApiStatic\s\{", "struct Abckit\S*ApiDynamic\s\{"]
libabckit_dir = os.path.join(script_dir, "..")
abckit_tests = os.path.join(libabckit_dir, "tests")
API_PATTERN = r'^[\w,\d,_, ,*]+\(\*([\w,\d,_]+)\)\(.*'
domain_patterns = [r'struct Abckit\S*Api\s\{', r'struct Abckit\S*ApiStatic\s\{', r'struct Abckit\S*ApiDynamic\s\{']
libabckit_dir = os.path.join(script_dir, '..')
abckit_tests = os.path.join(libabckit_dir, 'tests')
sources = {
"include/c/ir_core.h",
"include/c/metadata_core.h",
"include/c/extensions/arkts/metadata_arkts.h",
"include/c/extensions/js/metadata_js.h",
"src/include_v2/c/isa/isa_static.h",
"include/c/isa/isa_dynamic.h",
"include/c/abckit.h"
'include/c/ir_core.h',
'include/c/metadata_core.h',
'include/c/extensions/arkts/metadata_arkts.h',
'include/c/extensions/js/metadata_js.h',
'src/include_v2/c/isa/isa_static.h',
'include/c/isa/isa_dynamic.h',
'include/c/abckit.h'
}
TS = 'TS'
@ -91,24 +91,22 @@ def update_domain(old_domain, l):
new_domain = domain_match(l.strip())
if not new_domain:
return old_domain
return re.search('struct Abckit(.*)\s\{',
new_domain.strip()).group(1)
return re.search(r'struct Abckit(.*)\s\{', new_domain.strip()).group(1)
def collect_api(path):
api = {}
domain = ""
domain = ''
with open(path) as f:
for l in f.readlines():
domain = update_domain(domain, l)
if not re.fullmatch(API_PATTERN, l.strip()):
continue
# CC-OFFNXT(G.FIO.05) regexp false positive
if re.fullmatch('\/\/' + API_PATTERN, l.strip()):
if re.fullmatch(r'^\/\/' + API_PATTERN, l.strip()):
continue
func_name = re.search('^[\w,\d,_, ,*]+\(\*([\w,\d,_]+)\)\(.*', l.strip()).group(1)
if func_name == "cb":
func_name = re.search(r'^[\w,\d,_, ,*]+\(\*([\w,\d,_]+)\)\(.*', l.strip()).group(1)
if func_name == 'cb':
continue
check(domain)
api[f'{domain}Impl::{func_name}'] = API(func_name, domain)
@ -118,10 +116,10 @@ def collect_api(path):
def check_test_anno_line(line):
mul_lines = False
anno_line = False
if re.fullmatch("^\/\/ Test: test-kind=.*\n", line):
if re.fullmatch(r'^\/\/ Test: test-kind=.*\n', line):
anno_line = True
mul_lines = line.strip()[-1] == ','
return {"is_annotation_line" : anno_line, "mul_annotation_lines": mul_lines}
return {'is_annotation_line' : anno_line, 'mul_annotation_lines': mul_lines}
def get_full_annotation(it, annotation_start):
@ -130,7 +128,7 @@ def get_full_annotation(it, annotation_start):
while next_anno_line:
new_line = next(it)
annotation += new_line.replace('//', '').strip()
if not re.fullmatch("^\/\/.*,$", new_line):
if not re.fullmatch(r'^\/\/.*,$', new_line):
next_anno_line = False
return annotation
@ -179,20 +177,20 @@ class Test:
def is_first_test_line(line):
if re.fullmatch("TEST_F\(.*,.*\n", line):
if re.fullmatch(r'TEST_F\(.*,.*\n', line):
return True
return False
def get_test_from_annotation(api, annotation):
test = Test(annotation)
if "api=" in annotation and test.api != 'ApiImpl::GetLastError':
if 'api=' in annotation and test.api != 'ApiImpl::GetLastError':
check(test.api in api, f'No such API: {test.api}')
return test
def collect_tests(path, api):
with open(path, "r") as f:
with open(path, 'r') as f:
lines = f.readlines()
it = iter(lines)
tests = []
@ -211,13 +209,13 @@ def collect_tests(path, api):
continue
info = check_test_anno_line(line)
if not info.get("is_annotation_line"):
if not info.get('is_annotation_line'):
annotation = ''
continue
ano_count += 1
annotation += line.strip()
if info.get("mul_annotation_lines"):
if info.get('mul_annotation_lines'):
annotation = get_full_annotation(it, line)
else:
annotation = line.strip()
@ -267,7 +265,7 @@ def main(api) :
tests = []
for dirpath, _, filenames in os.walk(abckit_tests):
for name in filenames:
if name.endswith(".cpp"):
if name.endswith('.cpp'):
tests += collect_tests(os.path.join(dirpath, name), api)
api = get_tests_statistics(api, tests)
@ -304,23 +302,23 @@ def main(api) :
logging.debug('Total Tests: %s', len(tests))
logging.debug('')
logging.debug('Total API tests: %s',
len(list(filter(lambda t: t.kind == "api", tests))))
len(list(filter(lambda t: t.kind == 'api', tests))))
logging.debug('Positive/Negative/NullArg/WrongCtx/WrongMode API tests: %s/%s/%s/%s/%s',
api_test_category("positive"),
api_test_category("negative"),
api_test_category("negative-nullptr"),
api_test_category("negative-file"),
api_test_category("negative-mode"))
api_test_category('positive'),
api_test_category('negative'),
api_test_category('negative-nullptr'),
api_test_category('negative-file'),
api_test_category('negative-mode'))
logging.debug('ArkTS1/ArkTS2/JS/TS/NoABC API tests: %s/%s/%s/%s/%s',
api_lang(ARKTS1), api_lang(ARKTS2), api_lang(JS), api_lang(TS), api_lang(NO_ABC))
logging.debug('')
logging.debug('Total scenario tests: %s',
len(list(filter(lambda t: t.kind == "scenario", tests))))
len(list(filter(lambda t: t.kind == 'scenario', tests))))
logging.debug('ArkTS1/ArkTS2/JS/TS scenario tests: %s/%s/%s/%s',
scenario_lang(ARKTS1), scenario_lang(ARKTS2), scenario_lang(JS), scenario_lang(TS))
logging.debug('')
logging.debug('Internal tests: %s',
len(list(filter(lambda t: t.kind == "internal", tests))))
len(list(filter(lambda t: t.kind == 'internal', tests))))
collected_api = {}

View File

@ -13,7 +13,7 @@
def collect_implemented_api_map(excluded_funcs)
implemented_api_raw = nil
Dir.chdir(File.dirname(__FILE__)) do
implemented_api_raw = `python abckit_status.py --print-implemented`.split(/\n/)
implemented_api_raw = `python abckit_status.py --print-implemented 2>&1`.split(/\n/).sort
end
implemented_api_map = {}

View File

@ -14,17 +14,18 @@
set -e
base="$(basename $1)"
tmp="$(echo $base | sed 's/\..*//')"
tmp_file="/tmp/merge_$tmp.txt"
echo "$base;$tmp;esm;$base;entry" > $tmp_file
dir="$(dirname $1)"
modules_dir="$dir/modules"
if [ -d "$modules_dir" ]; then
for file in "$modules_dir"/*; do
name=$(basename "$file")
tmp_module="$(echo $name | sed 's/\..*//')"
echo "modules/$name;modules/$tmp_module;esm;modules/$name;entry" >> $tmp_file
OUT_DIR="$1"
BASE="$(basename $2)"
TMP="$(echo $BASE | sed 's/\..*//')"
TMP_FILE="$OUT_DIR/$(echo $2 | sed 's|[/\\ ]|_|g').txt"
echo "$BASE;$TMP;esm;$BASE;entry" > $TMP_FILE
DIR="$(dirname $2)"
MODULES_DIR="$DIR/modules"
if [ -d "$MODULES_DIR" ]; then
for file in "$MODULES_DIR"/*; do
NAME=$(basename "$file")
TMP_MODULE="$(echo $NAME | sed 's/\..*//')"
echo "modules/$NAME;modules/$TMP_MODULE;esm;modules/$NAME;entry" >> $TMP_FILE
done
fi
/usr/bin/python3 "$(dirname $0)/../../../ets_runtime/test/quickfix/generate_merge_file.py" --input "$tmp_file" --output "$2" --prefix "$dir/"
/usr/bin/python3 "$(dirname $0)/../../../ets_runtime/test/quickfix/generate_merge_file.py" --input "$TMP_FILE" --output "$3" --prefix "$DIR/"

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
FILE_PATH="${1}"
basename "$FILE_PATH"
echo "Fix options file path in ${FILE_PATH}"
sed -r 's/ PandArg/ panda::PandArg/' $1 | sed 's/PandArgParser/panda::PandArgParser/' &> $2

View File

@ -55,6 +55,7 @@ funcs_without_two_abckit_entites = [
"functionGetFile",
"functionGetModule",
"functionGetName",
"functionGetParentFunction",
"functionGetParentClass",
"functionEnumerateAnnotations",
"functionIsStatic",
@ -112,7 +113,7 @@ funcs_without_two_abckit_entites = [
"iVisitInputs",
"iVisitUsers",
"iSetImportDescriptor",
"bbClear",
"bbRemoveAllInsts",
"bbCreateEmpty",
"bbDump",
"bbGetFalseBranch",
@ -152,6 +153,7 @@ funcs_without_two_abckit_entites = [
"gGetEndBasicBlock",
"gGetNumberOfBasicBlocks",
"gGetParameter",
"gGetNumberOfParameters",
"gGetStartBasicBlock",
"gRunPassRemoveUnreachableBlocks",
"gVisitBlocksRpo",
@ -245,6 +247,7 @@ funcs_without_helper = [
"annotationInterfaceFieldGetName",
"classEnumerateAnnotations",
"functionEnumerateNestedFunctions",
"functionEnumerateNestedClasses",
"literalGetMethod",
"namespaceGetName",
"functionGetParentNamespace",
@ -284,7 +287,7 @@ funcs_without_helper = [
"moduleAddExportFromArkTsV2ToArkTsV2",
"moduleAddImportFromArkTsV2ToArkTsV2",
"moduleAddAnnotationInterface",
"fileAddExternalModule",
"fileAddExternalModuleArktsV1",
"annotationInterfaceAddField",
"moduleAddExportFromArkTsV1ToArkTsV1",
"bbGetPredBlock",
@ -305,6 +308,7 @@ funcs_without_helper = [
"annotationInterfaceFieldGetInterface",
"literalGetFile",
"annotationElementGetValue",
"classGetParentFunction",
"classGetParentNamespace",
"annotationGetInterface",
"annotationInterfaceFieldGetType",
@ -316,9 +320,8 @@ funcs_without_helper = [
"namespaceEnumerateClasses",
"valueGetFile",
"abckitStringToString",
"iCreateCatchPhi",
"bbCreateCatchPhi",
"iGetClass",
"iCreateCatchPhi",
"iSetClass",
"jsImportDescriptorToCoreImportDescriptor",
"jsFunctionToCoreFunction",

View File

@ -19,7 +19,7 @@ abckit_test = File.join(abckit_root, "/tests/wrong_mode_tests/")
implemented_api_raw = nil
Dir.chdir(abckit_scripts) do
implemented_api_raw = `python abckit_status.py --print-implemented`.split(/\n/)
implemented_api_raw = `python abckit_status.py --print-implemented 2>&1`.split(/\n/).sort
end
implemented_api_map = {}

View File

@ -112,7 +112,7 @@ build_and_run_tests() {
./tests/unittest/arkcompiler/runtime_core/libabckit/abckit_gtests
if [ "$SANITIZERS" = "false" ]; then
ninja abckit_stress_tests_package
ninja libabckit_stress_tests_package
if [ "$TARGET" = "x64.debug" ]; then
../../arkcompiler/runtime_core/libabckit/tests/stress/stress.py --build-dir $(realpath .)

View File

@ -18,18 +18,7 @@ ark_gen_file("abckit_options_gen_h") {
template_file = "$ark_root_dynamic/templates/options/options.h.erb"
data_file = "$abckit_root/src/options.yaml"
requires = [ "$ark_root_dynamic/templates/common.rb" ]
output_file = "$target_gen_dir/generated/tmp/abckit_options_gen.h"
}
action("abckit_options_h") {
script = "$abckit_root/scripts/fix_options.sh"
args = [
rebase_path("$target_gen_dir/generated/tmp/abckit_options_gen.h"),
rebase_path("$target_gen_dir/generated/abckit_options_gen.h"),
]
inputs = [ "$abckit_root/src/options.yaml" ]
outputs = [ "$target_gen_dir/generated/abckit_options_gen.h" ]
deps = [ ":abckit_options_gen_h" ]
output_file = "$target_gen_dir/generated/abckit_options_gen.h"
}
action("crop_abckit_intrinsics_yaml") {
@ -57,7 +46,7 @@ concat_yamls("abckit_concat_intrinsics_yaml") {
}
group("libabckit_header_deps") {
deps = [ ":abckit_options_h" ]
deps = [ ":abckit_options_gen_h" ]
}
ohos_source_set("libabckit_source_set") {

View File

@ -119,7 +119,7 @@ extern "C" void DestroyGraph(AbckitGraph *graph)
LIBABCKIT_BAD_ARGUMENT_VOID(graph);
if (IsDynamic(graph->function->m->target)) {
if (IsDynamic(graph->function->owningModule->target)) {
return DestroyGraphDynamic(graph);
}
DestroyGraphStatic(graph);

View File

@ -16,6 +16,7 @@
#include "libabckit/include/c/metadata_core.h"
#include "libabckit/src/adapter_dynamic/abckit_dynamic.h"
#include "libabckit/src/adapter_dynamic/helpers_dynamic.h"
#include "libabckit/src/helpers_common.h"
#include "libabckit/src/logger.h"
#include "libabckit/src/statuses_impl.h"
#include "libabckit/src/ir_impl.h"
@ -47,7 +48,7 @@ namespace fs = std::experimental::filesystem;
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace libabckit;
@ -126,8 +127,8 @@ bool FillExportDescriptor(ModuleIterateData *data, uint16_t idx, size_t recordIn
switch (data->m->target) {
case ABCKIT_TARGET_JS:
ed->impl = std::make_unique<AbckitJsExportDescriptor>();
ed->GetJSImpl()->core = ed.get();
ed->GetJSImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
ed->GetJsImpl()->core = ed.get();
ed->GetJsImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
break;
case ABCKIT_TARGET_ARK_TS_V1:
ed->impl = std::make_unique<AbckitArktsExportDescriptor>();
@ -155,7 +156,7 @@ bool FillExportDescriptor(ModuleIterateData *data, uint16_t idx, size_t recordIn
payload.impl = payloadDyn;
switch (data->m->target) {
case ABCKIT_TARGET_JS:
ed->GetJSImpl()->payload = payload;
ed->GetJsImpl()->payload = payload;
break;
case ABCKIT_TARGET_ARK_TS_V1:
ed->GetArkTSImpl()->payload = payload;
@ -172,7 +173,7 @@ void SetIdImpl(ModuleIterateData *data, std::unique_ptr<AbckitCoreImportDescript
switch (data->m->target) {
case ABCKIT_TARGET_JS:
id->impl = std::make_unique<AbckitJsImportDescriptor>();
id->GetJSImpl()->core = id.get();
id->GetJsImpl()->core = id.get();
break;
case ABCKIT_TARGET_ARK_TS_V1:
id->impl = std::make_unique<AbckitArktsImportDescriptor>();
@ -190,7 +191,7 @@ void SetIdModule(ModuleIterateData *data, std::unique_ptr<AbckitCoreImportDescri
id->importedModule = TryFindModule(importedModuleName, data->m->file);
switch (data->m->target) {
case ABCKIT_TARGET_JS:
id->GetJSImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
id->GetJsImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
break;
case ABCKIT_TARGET_ARK_TS_V1:
id->GetArkTSImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
@ -248,7 +249,7 @@ std::pair<size_t, size_t> FillImportSection(ModuleIterateData *data, size_t idx,
payload.impl = payloadDyn;
switch (data->m->target) {
case ABCKIT_TARGET_JS:
id->GetJSImpl()->payload = payload;
id->GetJsImpl()->payload = payload;
break;
case ABCKIT_TARGET_ARK_TS_V1:
id->GetArkTSImpl()->payload = payload;
@ -265,9 +266,9 @@ std::pair<size_t, size_t> FillImportSection(ModuleIterateData *data, size_t idx,
bool FindJSTarget(const std::unique_ptr<AbckitCoreExportDescriptor> &ed, ModuleIterateData *data,
const std::string &serviceName)
{
if (ed->GetJSImpl()->payload.GetDynamicPayload().hasServiceImport) {
if (ed->GetJsImpl()->payload.GetDynamicPayload().hasServiceImport) {
auto offset = data->payload->namespaceImportsOffset +
ed->GetJSImpl()->payload.GetDynamicPayload().serviceNamespaceImportIdx * 2;
ed->GetJsImpl()->payload.GetDynamicPayload().serviceNamespaceImportIdx * 2;
auto namespaceLocalName = std::get<std::string>(data->moduleLitArr->literals_[offset].value_);
if (serviceName == namespaceLocalName) {
return true;
@ -322,7 +323,7 @@ bool SetRecordIndexOff(size_t &i, ModuleIterateData *data, std::basic_string<cha
auto *starExport = FindStarExport(data, name);
switch (starExport->exportingModule->target) {
case ABCKIT_TARGET_JS: {
starExport->GetJSImpl()->payload.GetDynamicPayload().moduleRecordIndexOff = (*recordIndexOff)++;
starExport->GetJsImpl()->payload.GetDynamicPayload().moduleRecordIndexOff = (*recordIndexOff)++;
break;
}
case ABCKIT_TARGET_ARK_TS_V1: {
@ -424,7 +425,7 @@ void CreateModuleImpl(AbckitCoreModule *m)
switch (m->target) {
case ABCKIT_TARGET_JS:
m->impl = std::make_unique<AbckitJsModule>();
m->GetJSImpl()->core = m;
m->GetJsImpl()->core = m;
break;
case ABCKIT_TARGET_ARK_TS_V1:
m->impl = std::make_unique<AbckitArktsModule>();
@ -473,7 +474,7 @@ std::unique_ptr<AbckitCoreModule> CreateModule(pandasm::Program *prog, const pan
modulePayloadDyn.absPaths = true;
switch (m->target) {
case ABCKIT_TARGET_JS:
m->GetJSImpl()->impl = modulePayloadDyn;
m->GetJsImpl()->impl = modulePayloadDyn;
break;
case ABCKIT_TARGET_ARK_TS_V1:
m->GetArkTSImpl()->impl.impl = modulePayloadDyn;
@ -530,14 +531,19 @@ std::string DemangleScope(const std::string &mangledName, const AbckitLiteralArr
}
/*
* This function consumes full mangled name and returnes full parent name, for example:
* - enumerators0_dynamic.#&@2&A&B~C>D*E*#F -> enumerators0_dynamic.#&@2&A&B~C>D*#E
* - enumerators0_dynamic.#&@2&A&B~C>D*#E -> enumerators0_dynamic.#&@2&A&B~C>#D
* - enumerators0_dynamic.#&@2&A&B~C>#D -> enumerators0_dynamic.#&@2&A&B~C=#C
* - enumerators0_dynamic.#&@2&A&B~C=#C -> enumerators0_dynamic.#&@2&A&#B
* - enumerators0_dynamic.#&@2&A&#B -> enumerators0_dynamic.#&@2&#A
* - enumerators0_dynamic.#&@2&#A -> enumerators0_dynamic.#&#M0N0
* - enumerators0_dynamic.#&#M0N0 -> enumerators0_dynamic
* This function consumes full mangled name and returns full parent name, for example:
* - module.#&@2&A&B~C>D*E*#F -> module.#&@2&A&B~C>D*#E
* - module.#&@2&A&B~C>D*#E -> module.#&@2&A&B~C>#D
* - module.#&@2&A&B~C>#D -> module.#&@2&A&B~C=#C
* - module.#&@2&A&B~C=#C -> module.#&@2&A&#B
* - module.#&@2&A&#B -> module.#&@2&#A
* - module.#&@2&#A -> module.#&#M0N0
* - module.#&#M0N0 -> module
* NOTE: There is single function name for both constructor and class (for example "module.#~C=#C")
* For class parent is scope where this class was declared ("module")
* For constructor parent is class itself ("module.#~C=#C"))
* So for functions "GetFunctionParentKindAndName" should be used instead of "GetParentKindAndName" to handle this
* case
*/
std::pair<ParentKind, std::string> GetParentKindAndName(const std::string &name, const AbckitLiteralArray *scopeNames)
{
@ -580,6 +586,15 @@ std::pair<ParentKind, std::string> GetParentKindAndName(const std::string &name,
return {ParentKind::MODULE, moduleName};
}
std::pair<ParentKind, std::string> GetFunctionParentKindAndName(const std::string &name,
const AbckitLiteralArray *scopeNames)
{
if (IsCtor(name)) {
return {ParentKind::CLASS, name};
}
return GetParentKindAndName(name, scopeNames);
}
std::unique_ptr<AbckitCoreNamespace> CreateNamespace(pandasm::Function &func, AbckitFile *file)
{
std::string &functionName = func.name;
@ -589,7 +604,7 @@ std::unique_ptr<AbckitCoreNamespace> CreateNamespace(pandasm::Function &func, Ab
ASSERT(m->target == ABCKIT_TARGET_ARK_TS_V1);
auto namespaceFunc = std::make_unique<AbckitCoreFunction>();
namespaceFunc->m = m.get();
namespaceFunc->owningModule = m.get();
namespaceFunc->impl = std::make_unique<AbckitArktsFunction>();
namespaceFunc->GetArkTSImpl()->impl = &func;
namespaceFunc->GetArkTSImpl()->core = namespaceFunc.get();
@ -603,23 +618,33 @@ std::unique_ptr<AbckitCoreNamespace> CreateNamespace(pandasm::Function &func, Ab
return n;
}
AbckitLiteralArray *GetScopeNamesArray(AbckitCoreModule *m)
{
switch (m->target) {
case ABCKIT_TARGET_JS:
return m->GetJsImpl()->impl.scopeNamesLiteralArray;
case ABCKIT_TARGET_ARK_TS_V1:
return m->GetArkTSImpl()->impl.GetDynModule().scopeNamesLiteralArray;
default:
LIBABCKIT_UNREACHABLE;
}
}
void AssignNamespacesToParent(std::vector<std::unique_ptr<AbckitCoreNamespace>> &namespaces,
std::unordered_map<std::string, AbckitCoreNamespace *> &nameToNamespace)
{
for (auto &n : namespaces) {
ASSERT(n->m->target == ABCKIT_TARGET_ARK_TS_V1);
ASSERT(n->owningModule->target == ABCKIT_TARGET_ARK_TS_V1);
panda::pandasm::Function *func = n->GetArkTSImpl()->f->GetArkTSImpl()->GetDynamicImpl();
;
auto [kind, parentName] =
GetParentKindAndName(func->name, n->m->GetArkTSImpl()->impl.GetDynModule().scopeNamesLiteralArray);
auto [kind, parentName] = GetParentKindAndName(func->name, GetScopeNamesArray(n->owningModule));
switch (kind) {
case ParentKind::MODULE:
n->m->namespaces.emplace_back(std::move(n)).get();
n->owningModule->namespaces.emplace_back(std::move(n)).get();
break;
case ParentKind::NAMESPACE: {
ASSERT(nameToNamespace.count(parentName) == 1);
auto *parentNamespace = nameToNamespace[parentName];
n->n = nameToNamespace[parentName];
n->parentNamespace = nameToNamespace[parentName];
parentNamespace->namespaces.emplace_back(std::move(n)).get();
break;
}
@ -629,8 +654,8 @@ void AssignNamespacesToParent(std::vector<std::unique_ptr<AbckitCoreNamespace>>
}
}
void CreateClass(const std::string &functionName, panda::pandasm::Function &function, AbckitFile *file,
std::unordered_map<std::string, AbckitCoreNamespace *> &nameToNamespace,
std::unique_ptr<AbckitCoreClass> CreateClass(const std::string &functionName, panda::pandasm::Function &function,
AbckitFile *file,
std::unordered_map<std::string, AbckitCoreClass *> &nameToClass)
{
std::string moduleName = pandasm::GetOwnerName(functionName);
@ -639,42 +664,65 @@ void CreateClass(const std::string &functionName, panda::pandasm::Function &func
auto abckitFunction = &function;
std::unique_ptr<AbckitCoreClass> c;
AbckitLiteralArray *scopeNamesLiteralArray;
switch (m->target) {
case ABCKIT_TARGET_JS:
c = std::make_unique<AbckitCoreClass>(m.get(), AbckitJsClass(abckitFunction));
scopeNamesLiteralArray = m->GetJSImpl()->impl.scopeNamesLiteralArray;
break;
case ABCKIT_TARGET_ARK_TS_V1:
c = std::make_unique<AbckitCoreClass>(m.get(), AbckitArktsClass(abckitFunction));
scopeNamesLiteralArray = m->GetArkTSImpl()->impl.GetDynModule().scopeNamesLiteralArray;
break;
default:
LIBABCKIT_UNREACHABLE;
}
ASSERT(nameToClass.count(functionName) == 0);
nameToClass[functionName] = c.get();
return c;
}
auto [kind, parentName] = GetParentKindAndName(functionName, scopeNamesLiteralArray);
void AssignClassesToParent(std::vector<std::unique_ptr<AbckitCoreClass>> &klasses,
std::unordered_map<std::string, AbckitCoreNamespace *> &nameToNamespace,
std::unordered_map<std::string, AbckitCoreFunction *> &nameToFunction)
{
for (auto &klass : klasses) {
std::string name;
switch (klass->owningModule->target) {
case ABCKIT_TARGET_JS:
name = klass->GetJsImpl()->impl->name;
break;
case ABCKIT_TARGET_ARK_TS_V1:
name = klass->GetArkTSImpl()->impl.GetDynamicClass()->name;
break;
default:
LIBABCKIT_UNREACHABLE;
}
auto [kind, parentName] = GetParentKindAndName(name, GetScopeNamesArray(klass->owningModule));
switch (kind) {
case ParentKind::MODULE:
m->InsertClass(functionName, std::move(c));
klass->owningModule->InsertClass(name, std::move(klass));
break;
case ParentKind::NAMESPACE: {
ASSERT(nameToNamespace.count(parentName) != 0);
auto *n = nameToNamespace[parentName];
c->n = n;
n->classes.emplace_back(std::move(c));
klass->parentNamespace = n;
n->classes.emplace_back(std::move(klass));
break;
}
case ParentKind::FUNCTION: {
ASSERT(nameToFunction.count(parentName) != 0);
auto *f = nameToFunction[parentName];
klass->parentFunction = f;
f->nestedClasses.emplace_back(std::move(klass));
break;
}
case ParentKind::FUNCTION:
case ParentKind::CLASS:
m->InsertClass(functionName, std::move(c));
klass->owningModule->InsertClass(name, std::move(klass));
break;
default:
LIBABCKIT_UNREACHABLE;
}
}
}
void CreateAnnotationInterface(AbckitFile *file, const std::string &recName, pandasm::Record &rec)
{
@ -682,7 +730,7 @@ void CreateAnnotationInterface(AbckitFile *file, const std::string &recName, pan
std::string moduleName = pandasm::GetOwnerName(recName);
ASSERT(file->localModules.count(moduleName) != 0);
auto &module = file->localModules[moduleName];
ai->m = module.get();
ai->owningModule = module.get();
ai->impl = std::make_unique<AbckitArktsAnnotationInterface>();
ai->GetArkTSImpl()->impl = &rec;
ai->GetArkTSImpl()->core = ai.get();
@ -697,13 +745,7 @@ void CreateAnnotationInterface(AbckitFile *file, const std::string &recName, pan
aiField->ai = ai.get();
aiField->name = CreateNameString(field.name, file);
auto type = std::make_unique<AbckitType>();
type->id = PandaTypeToAbcKitTypeId(field.type);
type->rank = field.type.GetRank();
type->klass = nullptr;
aiField->type = type.get();
file->types.emplace_back(std::move(type));
aiField->type = GetOrCreateType(file, PandaTypeToAbcKitTypeId(field.type), field.type.GetRank(), nullptr);
if (field.metadata->GetValue().has_value()) {
auto abcval = std::make_unique<AbckitValue>();
@ -727,8 +769,8 @@ void SetImpl(std::unique_ptr<AbckitCoreFunction> &function, panda::pandasm::Func
switch (m->target) {
case ABCKIT_TARGET_JS:
function->impl = std::make_unique<AbckitJsFunction>();
function->GetJSImpl()->impl = &functionImpl;
function->GetJSImpl()->core = function.get();
function->GetJsImpl()->impl = &functionImpl;
function->GetJsImpl()->core = function.get();
break;
case ABCKIT_TARGET_ARK_TS_V1:
function->impl = std::make_unique<AbckitArktsFunction>();
@ -740,25 +782,13 @@ void SetImpl(std::unique_ptr<AbckitCoreFunction> &function, panda::pandasm::Func
}
}
std::unique_ptr<AbckitCoreFunction> CreateFunction(const std::string &functionName,
panda::pandasm::Function &functionImpl, AbckitFile *file)
void CreateFunctionAnnotations(AbckitFile *file, panda::pandasm::Function &functionImpl, AbckitCoreFunction *function)
{
LIBABCKIT_LOG(DEBUG) << functionName << '\n';
std::string moduleName = pandasm::GetOwnerName(functionName);
ASSERT(file->localModules.count(moduleName) != 0);
auto &m = file->localModules[moduleName];
auto function = std::make_unique<AbckitCoreFunction>();
function->m = m.get();
SetImpl(function, functionImpl, m);
ASSERT(file->nameToFunction.count(functionImpl.name) == 0);
file->nameToFunction[functionImpl.name] = function.get();
for (auto &annoImpl : functionImpl.metadata->GetAnnotations()) {
if (libabckit::IsServiceRecord(annoImpl.GetName())) {
continue;
}
ASSERT(function->m->target != ABCKIT_TARGET_JS);
ASSERT(function->owningModule->target == ABCKIT_TARGET_ARK_TS_V1);
auto anno = std::make_unique<AbckitCoreAnnotation>();
std::string aiModuleName = pandasm::GetOwnerName(annoImpl.GetName());
std::string aiName = pandasm::GetItemName(annoImpl.GetName());
@ -780,40 +810,64 @@ std::unique_ptr<AbckitCoreFunction> CreateFunction(const std::string &functionNa
anno->elements.emplace_back(std::move(annoElem));
}
anno->owner = function.get();
anno->owner = function;
function->annotations.emplace_back(std::move(anno));
}
}
std::unique_ptr<AbckitCoreFunction> CreateFunction(const std::string &functionName,
panda::pandasm::Function &functionImpl, AbckitFile *file)
{
std::string moduleName = pandasm::GetOwnerName(functionName);
ASSERT(file->localModules.count(moduleName) != 0);
auto &m = file->localModules[moduleName];
auto function = std::make_unique<AbckitCoreFunction>();
function->owningModule = m.get();
auto [kind, _] = GetFunctionParentKindAndName(functionName, GetScopeNamesArray(function->owningModule));
if (m->target == ABCKIT_TARGET_ARK_TS_V1) {
function->isAnonymous = kind == ParentKind::FUNCTION;
} else {
function->isAnonymous = IsAnonymousName(functionName);
}
SetImpl(function, functionImpl, m);
ASSERT(file->nameToFunction.count(functionImpl.name) == 0);
file->nameToFunction[functionImpl.name] = function.get();
CreateFunctionAnnotations(file, functionImpl, function.get());
return function;
}
void SetFunctions(std::unique_ptr<AbckitCoreFunction> &f, std::string &name, AbckitLiteralArray *scopeNamesLiteralArray,
void AssignFunction(std::unique_ptr<AbckitCoreFunction> &f, std::string &name,
AbckitLiteralArray *scopeNamesLiteralArray,
std::unordered_map<std::string, AbckitCoreNamespace *> &nameToNamespace,
std::unordered_map<std::string, AbckitCoreClass *> &nameToClass,
std::unordered_map<std::string, AbckitCoreFunction *> &nameToFunction)
{
auto [kind, parentName] = GetParentKindAndName(name, scopeNamesLiteralArray);
auto [kind, parentName] = GetFunctionParentKindAndName(name, scopeNamesLiteralArray);
switch (kind) {
case ParentKind::MODULE:
f->m->functions.emplace_back(std::move(f));
f->owningModule->functions.emplace_back(std::move(f));
return;
case ParentKind::NAMESPACE: {
ASSERT(nameToNamespace.count(parentName) == 1);
auto *n = nameToNamespace[parentName];
f->n = n;
f->parentNamespace = n;
n->functions.emplace_back(std::move(f));
return;
}
case ParentKind::CLASS: {
ASSERT(nameToClass.count(parentName) == 1);
auto *c = nameToClass[parentName];
f->klass = c;
f->parentClass = c;
c->methods.emplace_back(std::move(f));
return;
}
case ParentKind::FUNCTION: {
ASSERT(nameToFunction.count(parentName) == 1);
auto *parentF = nameToFunction[parentName];
f->parentFunction = parentF;
parentF->nestedFunction.emplace_back(std::move(f));
return;
}
@ -828,28 +882,28 @@ void AssignFunctionsToParent(std::vector<std::unique_ptr<AbckitCoreFunction>> &f
for (auto &f : functions) {
std::string name;
AbckitLiteralArray *scopeNamesLiteralArray;
switch (f->m->target) {
switch (f->owningModule->target) {
case ABCKIT_TARGET_JS:
name = f->GetJSImpl()->impl->name;
scopeNamesLiteralArray = f->m->GetJSImpl()->impl.scopeNamesLiteralArray;
name = f->GetJsImpl()->impl->name;
scopeNamesLiteralArray = f->owningModule->GetJsImpl()->impl.scopeNamesLiteralArray;
break;
case ABCKIT_TARGET_ARK_TS_V1:
name = f->GetArkTSImpl()->GetDynamicImpl()->name;
scopeNamesLiteralArray = f->m->GetArkTSImpl()->impl.GetDynModule().scopeNamesLiteralArray;
scopeNamesLiteralArray = f->owningModule->GetArkTSImpl()->impl.GetDynModule().scopeNamesLiteralArray;
break;
default:
LIBABCKIT_UNREACHABLE;
}
if (IsAnonymous(name)) {
f->m->functions.emplace_back(std::move(f));
if (f->isAnonymous) {
f->owningModule->functions.emplace_back(std::move(f));
continue;
}
if (IsCtor(name)) {
ASSERT(nameToClass.count(name) == 1);
auto *c = nameToClass[name];
f->klass = c;
f->parentClass = c;
for (auto &anno : f->annotations) {
anno->owner = c;
c->annotations.emplace_back(std::move(anno));
@ -859,22 +913,27 @@ void AssignFunctionsToParent(std::vector<std::unique_ptr<AbckitCoreFunction>> &f
continue;
}
SetFunctions(f, name, scopeNamesLiteralArray, nameToNamespace, nameToClass, nameToFunction);
AssignFunction(f, name, scopeNamesLiteralArray, nameToNamespace, nameToClass, nameToFunction);
}
}
void DumpHierarchy(AbckitFile *file)
{
std::function<void(AbckitCoreFunction * f, const std::string &indent)> dumpFunc =
[&dumpFunc](AbckitCoreFunction *f, const std::string &indent = "") {
std::function<void(AbckitCoreFunction * f, const std::string &indent)> dumpFunc;
std::function<void(AbckitCoreClass * c, const std::string &indent)> dumpClass;
dumpFunc = [&dumpFunc, &dumpClass](AbckitCoreFunction *f, const std::string &indent = "") {
auto fName = GetDynFunction(f)->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << fName << std::endl;
for (auto &cNested : f->nestedClasses) {
dumpClass(cNested.get(), indent + " ");
}
for (auto &fNested : f->nestedFunction) {
dumpFunc(fNested.get(), indent + " ");
}
};
auto dumpClass = [&dumpFunc](AbckitCoreClass *c, const std::string &indent = "") {
dumpClass = [&dumpFunc](AbckitCoreClass *c, const std::string &indent = "") {
auto cName = GetDynFunction(c)->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << cName << std::endl;
for (auto &f : c->methods) {
@ -884,7 +943,7 @@ void DumpHierarchy(AbckitFile *file)
std::function<void(AbckitCoreNamespace * n, const std::string &indent)> dumpNamespace =
[&dumpFunc, &dumpClass, &dumpNamespace](AbckitCoreNamespace *n, const std::string &indent = "") {
ASSERT(n->m->target == ABCKIT_TARGET_ARK_TS_V1);
ASSERT(n->owningModule->target == ABCKIT_TARGET_ARK_TS_V1);
auto &nName = GetDynFunction(n->GetArkTSImpl()->f.get())->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << nName << std::endl;
for (auto &n : n->namespaces) {
@ -904,7 +963,7 @@ void DumpHierarchy(AbckitFile *file)
dumpNamespace(n.get(), "");
}
for (auto &[cName, c] : m->ct) {
dumpClass(c.get());
dumpClass(c.get(), "");
}
for (auto &f : m->functions) {
dumpFunc(f.get(), "");
@ -1049,12 +1108,13 @@ void CreateWrappers(pandasm::Program *prog, AbckitFile *file)
CollectNamespaces(prog, file, &namespaces, &nameToNamespace);
// Collect classes
std::vector<std::unique_ptr<AbckitCoreClass>> classes;
std::unordered_map<std::string, AbckitCoreClass *> nameToClass;
for (auto &[functionName, function] : prog->function_table) {
if (!libabckit::IsCtor(functionName)) {
continue;
}
CreateClass(functionName, function, file, nameToNamespace, nameToClass);
classes.emplace_back(CreateClass(functionName, function, file, nameToClass));
}
// Collect functions
@ -1069,6 +1129,9 @@ void CreateWrappers(pandasm::Program *prog, AbckitFile *file)
ASSERT(nameToFunction.count(function.name) == 0);
nameToFunction[function.name] = functions.back().get();
}
// Assign parents
AssignClassesToParent(classes, nameToNamespace, nameToFunction);
AssignFunctionsToParent(functions, nameToNamespace, nameToClass, nameToFunction);
LIBABCKIT_LOG_DUMP(DumpHierarchy(file), DEBUG);

View File

@ -31,10 +31,10 @@ namespace fs = std::filesystem;
namespace fs = std::experimental::filesystem;
#endif
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace libabckit;
@ -184,7 +184,7 @@ AbckitModulePayloadDyn *GetModulePayload(AbckitCoreModule *module)
{
switch (module->target) {
case ABCKIT_TARGET_JS:
return &(module->GetJSImpl()->impl);
return &(module->GetJsImpl()->impl);
break;
case ABCKIT_TARGET_ARK_TS_V1:
return &(module->GetArkTSImpl()->impl.GetDynModule());
@ -522,7 +522,7 @@ bool IsStatic(const std::string &funcName)
return funcName.find("*#") != std::string::npos;
}
bool IsAnonymous(const std::string &funcName)
bool IsAnonymousName(const std::string &funcName)
{
if (IsMain(funcName)) {
return false;
@ -546,9 +546,9 @@ static std::string DemangleScopeName(const std::string &mangled, const AbckitLit
panda::pandasm::Function *GetDynFunction(AbckitCoreFunction *function)
{
switch (function->m->target) {
switch (function->owningModule->target) {
case ABCKIT_TARGET_JS:
return function->GetJSImpl()->impl;
return function->GetJsImpl()->impl;
case ABCKIT_TARGET_ARK_TS_V1:
return function->GetArkTSImpl()->GetDynamicImpl();
default:
@ -558,9 +558,9 @@ panda::pandasm::Function *GetDynFunction(AbckitCoreFunction *function)
panda::pandasm::Function *GetDynFunction(AbckitCoreClass *klass)
{
switch (klass->m->target) {
switch (klass->owningModule->target) {
case ABCKIT_TARGET_JS:
return klass->GetJSImpl()->impl;
return klass->GetJsImpl()->impl;
case ABCKIT_TARGET_ARK_TS_V1:
return klass->GetArkTSImpl()->impl.GetDynamicClass();
default:
@ -572,7 +572,7 @@ AbckitModulePayloadDyn *GetDynModulePayload(AbckitCoreModule *mod)
{
switch (mod->target) {
case ABCKIT_TARGET_JS:
return &mod->GetJSImpl()->impl;
return &mod->GetJsImpl()->impl;
case ABCKIT_TARGET_ARK_TS_V1:
return &mod->GetArkTSImpl()->impl.GetDynModule();
default:
@ -584,7 +584,7 @@ AbckitDynamicImportDescriptorPayload *GetDynImportDescriptorPayload(AbckitCoreIm
{
switch (id->importingModule->target) {
case ABCKIT_TARGET_JS:
return &id->GetJSImpl()->payload.GetDynId();
return &id->GetJsImpl()->payload.GetDynId();
case ABCKIT_TARGET_ARK_TS_V1:
return &id->GetArkTSImpl()->payload.GetDynId();
default:
@ -597,7 +597,7 @@ AbckitDynamicExportDescriptorPayload *GetDynExportDescriptorPayload(AbckitCoreEx
AbckitDynamicExportDescriptorPayload *edPayload = nullptr;
switch (ed->exportingModule->target) {
case ABCKIT_TARGET_JS:
edPayload = &ed->GetJSImpl()->payload.GetDynamicPayload();
edPayload = &ed->GetJsImpl()->payload.GetDynamicPayload();
break;
case ABCKIT_TARGET_ARK_TS_V1:
edPayload = &ed->GetArkTSImpl()->payload.GetDynamicPayload();

View File

@ -61,7 +61,7 @@ bool IsMain(const std::string &funcName);
bool IsFunction(const std::string &funcName);
bool IsCtor(const std::string &funcName);
bool IsStatic(const std::string &funcName);
bool IsAnonymous(const std::string &funcName);
bool IsAnonymousName(const std::string &funcName);
panda::pandasm::Function *GetDynFunction(AbckitCoreFunction *function);
panda::pandasm::Function *GetDynFunction(AbckitCoreClass *klass);

View File

@ -18,6 +18,7 @@
#include "libabckit/src/adapter_dynamic/metadata_inspect_dynamic.h"
#include "libabckit/src/adapter_dynamic/metadata_modify_dynamic.h"
#include "libabckit/src/adapter_dynamic/helpers_dynamic.h"
#include "libabckit/src/helpers_common.h"
#include "libabckit/src/macros.h"
#include "libabckit/src/metadata_inspect_impl.h"
#include "libabckit/src/statuses_impl.h"
@ -35,7 +36,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;
@ -67,12 +68,12 @@ void ModuleEnumerateAnonymousFunctionsDynamic(AbckitCoreModule *m, void *data,
AbckitString *NamespaceGetNameDynamic(AbckitCoreNamespace *n)
{
LIBABCKIT_LOG_FUNC;
ASSERT(n->m->target == ABCKIT_TARGET_ARK_TS_V1);
ASSERT(n->owningModule->target == ABCKIT_TARGET_ARK_TS_V1);
auto func = GetDynFunction(n->GetArkTSImpl()->f.get());
auto name = func->name;
size_t sharpPos = name.rfind('#');
ASSERT(sharpPos != std::string::npos);
return CreateStringDynamic(n->m->file, name.substr(sharpPos + 1).data());
return CreateStringDynamic(n->owningModule->file, name.substr(sharpPos + 1).data());
}
// ========================================
@ -84,12 +85,12 @@ AbckitString *ClassGetNameDynamic(AbckitCoreClass *klass)
LIBABCKIT_LOG_FUNC;
auto func = GetDynFunction(klass);
auto mPayload = GetDynModulePayload(klass->m);
auto mPayload = GetDynModulePayload(klass->owningModule);
auto *scopesLitArr = mPayload->scopeNamesLiteralArray;
auto name = GetClassNameFromCtor(func->name, scopesLitArr);
return CreateStringDynamic(klass->m->file, name.data());
return CreateStringDynamic(klass->owningModule->file, name.data());
}
// ========================================
@ -103,7 +104,7 @@ AbckitString *FunctionGetNameDynamic(AbckitCoreFunction *function)
auto name = functionImpl->name;
size_t sharpPos = name.rfind('#');
if (!IsAnonymous(name)) {
if (!function->isAnonymous) {
if (sharpPos != std::string::npos) {
name = name.substr(sharpPos + 1);
} else {
@ -112,7 +113,7 @@ AbckitString *FunctionGetNameDynamic(AbckitCoreFunction *function)
}
}
return CreateStringDynamic(function->m->file, name.data());
return CreateStringDynamic(function->owningModule->file, name.data());
}
AbckitGraph *CreateGraphFromFunctionDynamic(AbckitCoreFunction *function)
@ -123,8 +124,8 @@ AbckitGraph *CreateGraphFromFunctionDynamic(AbckitCoreFunction *function)
LIBABCKIT_LOG(DEBUG) << func->name << '\n';
LIBABCKIT_LOG_DUMP(func->DebugDump(), DEBUG);
auto *file = function->m->file;
auto program = function->m->file->GetDynamicProgram();
auto *file = function->owningModule->file;
auto program = function->owningModule->file->GetDynamicProgram();
auto maps = std::make_unique<pandasm::AsmEmitter::PandaFileToPandaAsmMaps>();
auto pf = EmitDynamicProgram(file, program, maps.get(), true);
@ -177,8 +178,7 @@ bool FunctionIsCtorDynamic(AbckitCoreFunction *function)
bool FunctionIsAnonymousDynamic(AbckitCoreFunction *function)
{
LIBABCKIT_LOG_FUNC;
auto *func = GetDynFunction(function);
return IsAnonymous(func->name);
return function->isAnonymous;
}
bool FunctionIsNativeDynamic(AbckitCoreFunction *function)
@ -196,7 +196,7 @@ AbckitString *AnnotationInterfaceGetNameDynamic(AbckitCoreAnnotationInterface *a
{
LIBABCKIT_LOG_FUNC;
auto name = pandasm::GetItemName(ai->GetArkTSImpl()->GetDynamicImpl()->name);
return CreateStringDynamic(ai->m->file, name.data());
return CreateStringDynamic(ai->owningModule->file, name.data());
}
// ========================================
@ -396,25 +396,17 @@ AbckitLiteralArray *LiteralGetLiteralArrayDynamic(AbckitLiteral *lit)
}
auto &litarrs = lit->file->GetDynamicProgram()->literalarray_table;
auto &arrName = std::get<std::string>(literal->value_);
auto &val = std::get<std::string>(literal->value_);
if (litarrs.find(val) != litarrs.end()) {
// Search through already created abckit litarrs
for (auto &item : lit->file->litarrs) {
if (item->GetDynamicImpl() == &litarrs[val]) {
if (item->GetDynamicImpl() == &litarrs[arrName]) {
return item.get();
}
}
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
}
panda::pandasm::LiteralArray *impl = nullptr;
for (auto &item : lit->file->GetDynamicProgram()->literalarray_table) {
if (item.first == val) {
impl = &item.second;
break;
}
}
auto litarr = std::make_unique<AbckitLiteralArray>(lit->file, impl);
// Create new abckit litarrs
auto litarr = std::make_unique<AbckitLiteralArray>(lit->file, &litarrs[arrName]);
lit->file->litarrs.emplace_back(std::move(litarr));
return lit->file->litarrs[lit->file->litarrs.size() - 1].get();
}
@ -518,38 +510,37 @@ AbckitType *ValueGetTypeDynamic(AbckitValue *value)
{
LIBABCKIT_LOG_FUNC;
auto *pVal = static_cast<pandasm::ScalarValue *>(value->GetDynamicImpl());
auto type = std::make_unique<AbckitType>();
type->klass = nullptr; // NOTE implement logic for classes
AbckitTypeId id;
switch (pVal->GetType()) {
case pandasm::Value::Type::U1:
type->id = ABCKIT_TYPE_ID_U1;
id = ABCKIT_TYPE_ID_U1;
break;
case pandasm::Value::Type::U8:
type->id = ABCKIT_TYPE_ID_U8;
id = ABCKIT_TYPE_ID_U8;
break;
case pandasm::Value::Type::U16:
type->id = ABCKIT_TYPE_ID_U16;
id = ABCKIT_TYPE_ID_U16;
break;
case pandasm::Value::Type::U32:
type->id = ABCKIT_TYPE_ID_U32;
id = ABCKIT_TYPE_ID_U32;
break;
case pandasm::Value::Type::U64:
type->id = ABCKIT_TYPE_ID_U64;
id = ABCKIT_TYPE_ID_U64;
break;
case pandasm::Value::Type::F64:
type->id = ABCKIT_TYPE_ID_F64;
id = ABCKIT_TYPE_ID_F64;
break;
case pandasm::Value::Type::STRING:
type->id = ABCKIT_TYPE_ID_STRING;
id = ABCKIT_TYPE_ID_STRING;
break;
case pandasm::Value::Type::LITERALARRAY:
type->id = ABCKIT_TYPE_ID_LITERALARRAY;
id = ABCKIT_TYPE_ID_LITERALARRAY;
break;
default:
LIBABCKIT_UNIMPLEMENTED;
}
value->file->types.emplace_back(std::move(type));
return value->file->types.back().get();
// NOTE implement logic for classes
return GetOrCreateType(value->file, id, 0, nullptr);
}
bool ValueGetU1Dynamic(AbckitValue *value)
@ -598,9 +589,18 @@ AbckitLiteralArray *ArrayValueGetLiteralArrayDynamic(AbckitValue *value)
}
auto *pVal = static_cast<pandasm::ScalarValue *>(value->GetDynamicImpl());
auto valImpl = pVal->GetValue<std::string>();
auto *prog = value->file->GetDynamicProgram();
auto litarr = std::make_unique<AbckitLiteralArray>(value->file, &(prog->literalarray_table[valImpl]));
auto arrName = pVal->GetValue<std::string>();
auto &litarrs = value->file->GetDynamicProgram()->literalarray_table;
// Search through already created abckit litarrs
for (auto &item : value->file->litarrs) {
if (item->GetDynamicImpl() == &litarrs[arrName]) {
return item.get();
}
}
// Create new abckit litarr
auto litarr = std::make_unique<AbckitLiteralArray>(value->file, &(litarrs[arrName]));
return value->file->litarrs.emplace_back(std::move(litarr)).get();
}

View File

@ -41,7 +41,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;
@ -111,12 +111,13 @@ void FunctionSetGraphDynamic(AbckitCoreFunction *function, AbckitGraph *graph)
delete newFunc;
}
AbckitJsModule *FileAddExternalModuleDynamic(AbckitFile *file, const struct AbckitJsExternalModuleCreateParams *params)
AbckitJsModule *FileAddExternalJsModule(AbckitFile *file, const struct AbckitJsExternalModuleCreateParams *params)
{
auto m = std::make_unique<AbckitCoreModule>();
m->impl = std::make_unique<AbckitJsModule>();
m->file = file;
m->target = ABCKIT_TARGET_JS;
m->GetJsImpl()->core = m.get();
auto *prog = file->GetDynamicProgram();
@ -134,18 +135,19 @@ AbckitJsModule *FileAddExternalModuleDynamic(AbckitFile *file, const struct Abck
m->isExternal = true;
auto modulePayloadDyn = AbckitModulePayloadDyn();
modulePayloadDyn.absPaths = false;
m->GetJSImpl()->impl = modulePayloadDyn;
m->GetJsImpl()->impl = modulePayloadDyn;
file->externalModules.insert({params->name, std::move(m)});
return file->externalModules[params->name]->GetJSImpl();
return file->externalModules[params->name]->GetJsImpl();
}
AbckitArktsModule *FileAddExternalModuleDynamic(AbckitFile *file,
const struct AbckitArktsExternalModuleCreateParams *params)
AbckitArktsModule *FileAddExternalArkTsV1Module(AbckitFile *file,
const struct AbckitArktsV1ExternalModuleCreateParams *params)
{
auto m = std::make_unique<AbckitCoreModule>();
m->impl = std::make_unique<AbckitArktsModule>();
m->file = file;
m->target = ABCKIT_TARGET_ARK_TS_V1;
m->GetArkTSImpl()->core = m.get();
auto *prog = file->GetDynamicProgram();
@ -347,12 +349,12 @@ AbckitJsImportDescriptor *ModuleAddImportFromDynamicModuleDynamic(
auto payload = AbckitCoreImportDescriptorPayload();
payload.impl = payloadDyn;
id->impl = std::make_unique<AbckitJsImportDescriptor>();
id->GetJSImpl()->payload = payload;
id->GetJSImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
id->GetJSImpl()->core = id.get();
id->GetJsImpl()->payload = payload;
id->GetJsImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
id->GetJsImpl()->core = id.get();
importing->id.push_back(std::move(id));
return importing->id[importing->id.size() - 1]->GetJSImpl();
return importing->id[importing->id.size() - 1]->GetJsImpl();
}
template <class T>
@ -547,11 +549,11 @@ AbckitJsExportDescriptor *DynamicModuleAddExportDynamic(AbckitCoreModule *export
auto payload = AbckitCoreExportDescriptorPayload();
payload.impl = payloadDyn;
ed->impl = std::make_unique<AbckitJsExportDescriptor>();
ed->GetJSImpl()->payload = payload;
ed->GetJSImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
ed->GetJSImpl()->core = ed.get();
ed->GetJsImpl()->payload = payload;
ed->GetJsImpl()->kind = AbckitImportExportDescriptorKind::UNTYPED;
ed->GetJsImpl()->core = ed.get();
exporting->ed.push_back(std::move(ed));
return exporting->ed[exporting->ed.size() - 1]->GetJSImpl();
return exporting->ed[exporting->ed.size() - 1]->GetJsImpl();
}
void ModuleRemoveExportDynamic(AbckitCoreModule *m, AbckitArktsExportDescriptor *i)
@ -566,7 +568,6 @@ void ModuleRemoveExportDynamic(AbckitCoreModule *m, AbckitArktsExportDescriptor
}
auto idxOffset = 0;
;
auto gap = 0;
auto mPayload = GetDynModulePayload(m);
switch (i->payload.GetDynamicPayload().kind) {
@ -604,7 +605,6 @@ void ModuleRemoveExportDynamic(AbckitCoreModule *m, AbckitJsExportDescriptor *i)
}
auto idxOffset = 0U;
;
auto gap = 0U;
auto mPayload = GetDynModulePayload(m);
switch (i->payload.GetDynamicPayload().kind) {
@ -722,8 +722,7 @@ AbckitLiteralArray *CreateLiteralArrayDynamic(AbckitFile *file, AbckitLiteral **
// NOLINTNEXTLINE(cert-msc51-cpp)
uint32_t arrayOffset = 0;
while (prog->literalarray_table.find(std::to_string(arrayOffset)) != prog->literalarray_table.end()) {
LIBABCKIT_LOG(DEBUG) << "generating new arrayOffset\n";
arrayOffset = std::stoi(prog->literalarray_table.rbegin()->first) + 1;
arrayOffset++;
}
auto arrayName = std::to_string(arrayOffset);
@ -813,7 +812,7 @@ AbckitArktsAnnotationInterface *ModuleAddAnnotationInterfaceDynamic(
prog->record_table.emplace(name, std::move(progRecord));
pandasm::Record &record = prog->record_table.find(name)->second;
auto ai = std::make_unique<AbckitCoreAnnotationInterface>();
ai->m = m;
ai->owningModule = m;
ai->impl = std::make_unique<AbckitArktsAnnotationInterface>();
ai->GetArkTSImpl()->impl = &record;
ai->GetArkTSImpl()->core = ai.get();
@ -911,19 +910,19 @@ AbckitArktsAnnotationElement *AnnotationAddAnnotationElementDynamic(AbckitCoreAn
auto annoElem = std::make_unique<AbckitCoreAnnotationElement>();
annoElem->ann = anno;
annoElem->name = CreateStringDynamic(anno->ai->m->file, progAnnoElem.GetName().data());
annoElem->name = CreateStringDynamic(anno->ai->owningModule->file, progAnnoElem.GetName().data());
annoElem->value = std::move(abcValue);
if (std::holds_alternative<AbckitCoreFunction *>(anno->owner)) {
auto *func = std::get<AbckitCoreFunction *>(anno->owner);
auto progOwner = func->GetArkTSImpl()->GetDynamicImpl();
progOwner->metadata->AddAnnotationElementByName(name, std::move(progAnnoElem));
annoElem->value->file = func->m->file;
annoElem->value->file = func->owningModule->file;
} else if (std::holds_alternative<AbckitCoreClass *>(anno->owner)) {
auto *klass = std::get<AbckitCoreClass *>(anno->owner);
auto progOwner = klass->GetArkTSImpl()->impl.GetDynamicClass();
progOwner->metadata->AddAnnotationElementByName(name, std::move(progAnnoElem));
annoElem->value->file = klass->m->file;
annoElem->value->file = klass->owningModule->file;
}
annoElem->impl = std::make_unique<AbckitArktsAnnotationElement>();
@ -1006,7 +1005,7 @@ AbckitArktsAnnotationInterfaceField *AnnotationInterfaceAddFieldDynamic(
auto field = std::make_unique<AbckitCoreAnnotationInterfaceField>();
field->ai = ai;
field->name = CreateStringDynamic(ai->m->file, name);
field->name = CreateStringDynamic(ai->owningModule->file, name);
field->type = type;
field->value = value;
@ -1016,7 +1015,7 @@ AbckitArktsAnnotationInterfaceField *AnnotationInterfaceAddFieldDynamic(
auto record = ai->GetArkTSImpl()->GetDynamicImpl();
auto prog = ai->m->file->GetDynamicProgram();
auto prog = ai->owningModule->file->GetDynamicProgram();
auto progField = pandasm::Field(prog->lang);
progField.name = name;

View File

@ -24,9 +24,9 @@ namespace libabckit {
AbckitString *CreateStringDynamic(AbckitFile *file, const char *value);
void FunctionSetGraphDynamic(AbckitCoreFunction *function, AbckitGraph *graph);
AbckitJsModule *FileAddExternalModuleDynamic(AbckitFile *file, const struct AbckitJsExternalModuleCreateParams *params);
AbckitArktsModule *FileAddExternalModuleDynamic(AbckitFile *file,
const struct AbckitArktsExternalModuleCreateParams *params);
AbckitJsModule *FileAddExternalJsModule(AbckitFile *file, const struct AbckitJsExternalModuleCreateParams *params);
AbckitArktsModule *FileAddExternalArkTsV1Module(AbckitFile *file,
const struct AbckitArktsV1ExternalModuleCreateParams *params);
void ModuleRemoveImportDynamic(AbckitCoreModule *m, AbckitArktsImportDescriptor *i);
void ModuleRemoveImportDynamic(AbckitCoreModule *m, AbckitJsImportDescriptor *i);
AbckitArktsImportDescriptor *ModuleAddImportFromDynamicModuleDynamic(

View File

@ -39,7 +39,7 @@ using namespace ark;
namespace libabckit {
[[maybe_unused]] static bool IsAbstract(pandasm::ItemMetadata *meta)
static bool IsAbstract(pandasm::ItemMetadata *meta)
{
uint32_t flags = meta->GetAccessFlags();
return (flags & ACC_ABSTRACT) != 0U;
@ -50,17 +50,76 @@ AbckitString *CreateNameString(AbckitFile *file, std::string &name)
return CreateStringStatic(file, name.data());
}
void CollectFunction(AbckitFile *file, std::unordered_set<std::string> &globalClassNames,
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &modulesMap,
pandasm::Function *FunctionGetImpl(AbckitCoreFunction *function)
{
return function->GetArkTSImpl()->GetStaticImpl();
}
static void DumpHierarchy(AbckitFile *file)
{
std::function<void(AbckitCoreFunction * f, const std::string &indent)> dumpFunc;
std::function<void(AbckitCoreClass * c, const std::string &indent)> dumpClass;
dumpFunc = [&dumpFunc, &dumpClass](AbckitCoreFunction *f, const std::string &indent = "") {
auto fName = FunctionGetImpl(f)->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << fName << std::endl;
for (auto &cNested : f->nestedClasses) {
dumpClass(cNested.get(), indent + " ");
}
for (auto &fNested : f->nestedFunction) {
dumpFunc(fNested.get(), indent + " ");
}
};
dumpClass = [&dumpFunc](AbckitCoreClass *c, const std::string &indent = "") {
auto cName = c->GetArkTSImpl()->impl.GetStaticClass()->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << cName << std::endl;
for (auto &f : c->methods) {
dumpFunc(f.get(), indent + " ");
}
};
std::function<void(AbckitCoreNamespace * n, const std::string &indent)> dumpNamespace =
[&dumpFunc, &dumpClass, &dumpNamespace](AbckitCoreNamespace *n, const std::string &indent = "") {
ASSERT(n->owningModule->target == ABCKIT_TARGET_ARK_TS_V1);
auto &nName = FunctionGetImpl(n->GetArkTSImpl()->f.get())->name;
LIBABCKIT_LOG_NO_FUNC(DEBUG) << indent << nName << std::endl;
for (auto &n : n->namespaces) {
dumpNamespace(n.get(), indent + " ");
}
for (auto &c : n->classes) {
dumpClass(c.get(), indent + " ");
}
for (auto &f : n->functions) {
dumpFunc(f.get(), indent + " ");
}
};
for (auto &[mName, m] : file->localModules) {
LIBABCKIT_LOG_NO_FUNC(DEBUG) << mName << std::endl;
for (auto &n : m->namespaces) {
dumpNamespace(n.get(), "");
}
for (auto &[cName, c] : m->ct) {
dumpClass(c.get(), "");
}
for (auto &f : m->functions) {
dumpFunc(f.get(), "");
}
}
}
std::unique_ptr<AbckitCoreFunction> CollectFunction(
AbckitFile *file, std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &nameToModule,
const std::string &functionName, ark::pandasm::Function &functionImpl)
{
auto [moduleName, className] = FuncGetNames(functionName);
LIBABCKIT_LOG(DEBUG) << " Found function. module: '" << moduleName << "' class: '" << className << "' function: '"
<< functionName << "'\n";
ASSERT(modulesMap.find(moduleName) != modulesMap.end());
auto &functionModule = modulesMap[moduleName];
ASSERT(nameToModule.find(moduleName) != nameToModule.end());
auto &functionModule = nameToModule[moduleName];
auto function = std::make_unique<AbckitCoreFunction>();
function->m = functionModule.get();
function->owningModule = functionModule.get();
function->impl = std::make_unique<AbckitArktsFunction>();
function->GetArkTSImpl()->impl = &functionImpl;
function->GetArkTSImpl()->core = function.get();
@ -87,51 +146,16 @@ void CollectFunction(AbckitFile *file, std::unordered_set<std::string> &globalCl
function->annotations.emplace_back(std::move(anno));
}
if (globalClassNames.find(className) != globalClassNames.end()) {
functionModule->functions.emplace_back(std::move(function));
} else {
ASSERT(functionModule->ct.find(className) != functionModule->ct.end());
auto &klass = functionModule->ct[className];
function->klass = klass.get();
klass->methods.emplace_back(std::move(function));
}
}
static void CollectFunctions(pandasm::Program *prog, AbckitFile *file,
std::unordered_set<std::string> &globalClassNames,
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &modulesMap)
{
static const std::string LAMBDA_RECORD_KEY = "LambdaObject";
static const std::string INIT_FUNC_NAME = "_$init$_";
static const std::string TRIGGER_CCTOR_FUNC_NAME = "_$trigger_cctor$_";
for (auto &[functionName, functionImpl] : prog->functionTable) {
auto [moduleName, className] = FuncGetNames(functionName);
if (functionImpl.metadata->IsForeign() ||
(className.substr(0, LAMBDA_RECORD_KEY.size()) == LAMBDA_RECORD_KEY) ||
(functionName.find(INIT_FUNC_NAME, 0) != std::string::npos) ||
(functionName.find(TRIGGER_CCTOR_FUNC_NAME, 0) != std::string::npos)) {
// NOTE: find and fill AbckitCoreImportDescriptor
continue;
}
if (IsAbstract(functionImpl.metadata.get())) {
// NOTE: ?
continue;
}
CollectFunction(file, globalClassNames, modulesMap, functionName, functionImpl);
}
return function;
}
static void CreateModule(AbckitFile *file, std::unordered_set<std::string> &globalClassNames,
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &modulesMap,
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &nameToModule,
const std::string &recordName)
{
auto [moduleName, className] = ClassGetNames(recordName);
if (globalClassNames.find(className) != globalClassNames.end()) {
if (modulesMap.find(moduleName) != modulesMap.end()) {
if (nameToModule.find(moduleName) != nameToModule.end()) {
LIBABCKIT_LOG(FATAL) << "Duplicated ETSGLOBAL for module: " << moduleName << '\n';
}
@ -142,41 +166,95 @@ static void CreateModule(AbckitFile *file, std::unordered_set<std::string> &glob
m->moduleName = CreateStringStatic(file, moduleName.data());
m->impl = std::make_unique<AbckitArktsModule>();
m->GetArkTSImpl()->core = m.get();
modulesMap.insert({moduleName, std::move(m)});
nameToModule.insert({moduleName, std::move(m)});
}
}
void CreateClass(std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &modulesMap,
const std::string &moduleName, const std::string &className, ark::pandasm::Record &record)
std::unique_ptr<AbckitCoreClass> CreateClass(
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &nameToModule, const std::string &moduleName,
const std::string &className, ark::pandasm::Record &record)
{
LIBABCKIT_LOG(DEBUG) << " Found class. module: '" << moduleName << "' class: '" << className << "'\n";
ASSERT(modulesMap.find(moduleName) != modulesMap.end());
auto &classModule = modulesMap[moduleName];
ASSERT(nameToModule.find(moduleName) != nameToModule.end());
auto &classModule = nameToModule[moduleName];
auto abckitRecord = &record;
auto klass = std::make_unique<AbckitCoreClass>(classModule.get(), AbckitArktsClass(abckitRecord));
classModule->InsertClass(className, std::move(klass));
return klass;
}
// CC-OFFNXT(G.FUD.05) huge function
static void CreateWrappers(pandasm::Program *prog, AbckitFile *file)
static void AssignClasses(std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &nameToModule,
std::vector<std::unique_ptr<AbckitCoreClass>> &classes)
{
std::unordered_set<std::string> globalClassNames = {"ETSGLOBAL", "_GLOBAL"};
for (auto &klass : classes) {
auto fullName = klass->GetArkTSImpl()->impl.GetStaticClass()->name;
auto [moduleName, className] = ClassGetNames(fullName);
LIBABCKIT_LOG(DEBUG) << "moduleName, className, fullName: " << moduleName << ", " << className << ", "
<< fullName << '\n';
auto &classModule = nameToModule[moduleName];
classModule->InsertClass(className, std::move(klass));
}
}
static void AssignFunctions(std::unordered_set<std::string> &globalClassNames,
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> &nameToModule,
[[maybe_unused]] std::unordered_map<std::string, AbckitCoreClass *> &nameToClass,
std::vector<std::unique_ptr<AbckitCoreFunction>> &functions)
{
for (auto &function : functions) {
std::string functionName = FunctionGetImpl(function.get())->name;
auto [moduleName, className] = FuncGetNames(functionName);
auto &functionModule = nameToModule[moduleName];
if (globalClassNames.find(className) != globalClassNames.end()) {
functionModule->functions.emplace_back(std::move(function));
} else {
ASSERT(functionModule->ct.find(className) != functionModule->ct.end());
auto &klass = functionModule->ct[className];
function->parentClass = klass.get();
klass->methods.emplace_back(std::move(function));
}
}
}
static const std::string LAMBDA_RECORD_KEY = "LambdaObject";
static const std::string INIT_FUNC_NAME = "_$init$_";
static const std::string TRIGGER_CCTOR_FUNC_NAME = "_$trigger_cctor$_";
static bool ShouldCreateFuncWrapper(pandasm::Function &functionImpl, const std::string &className,
const std::string &functionName)
{
if (functionImpl.metadata->IsForeign() || (className.substr(0, LAMBDA_RECORD_KEY.size()) == LAMBDA_RECORD_KEY) ||
(functionName.find(INIT_FUNC_NAME, 0) != std::string::npos) ||
(functionName.find(TRIGGER_CCTOR_FUNC_NAME, 0) != std::string::npos)) {
// NOTE: find and fill AbckitCoreImportDescriptor
return false;
}
if (IsAbstract(functionImpl.metadata.get())) {
// NOTE: ?
return false;
}
return true;
}
static void CreateWrappers(pandasm::Program *prog, AbckitFile *file)
{
std::unordered_set<std::string> globalClassNames = {"ETSGLOBAL", "_GLOBAL"};
file->program = prog;
// Collect modules
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> modulesMap;
std::unordered_map<std::string, std::unique_ptr<AbckitCoreModule>> nameToModule;
for (auto &[recordName, record] : prog->recordTable) {
if (record.metadata->IsForeign()) {
// NOTE: Create AbckitCoreImportDescriptor and AbckitCoreModuleDescriptor
continue;
}
CreateModule(file, globalClassNames, modulesMap, recordName);
CreateModule(file, globalClassNames, nameToModule, recordName);
}
// Collect classes
std::vector<std::unique_ptr<AbckitCoreClass>> classes;
std::unordered_map<std::string, AbckitCoreClass *> nameToClass;
for (auto &[recordName, record] : prog->recordTable) {
if (record.metadata->IsForeign() || (recordName.find(LAMBDA_RECORD_KEY) != std::string::npos)) {
// NOTE: find and fill AbckitCoreImportDescriptor
@ -189,19 +267,34 @@ static void CreateWrappers(pandasm::Program *prog, AbckitFile *file)
if (globalClassNames.find(className) != globalClassNames.end()) {
continue;
}
CreateClass(modulesMap, moduleName, className, record);
classes.emplace_back(CreateClass(nameToModule, moduleName, className, record));
nameToClass[recordName] = classes.back().get();
}
// Functions
CollectFunctions(prog, file, globalClassNames, modulesMap);
std::vector<std::unique_ptr<AbckitCoreFunction>> functions;
std::unordered_map<std::string, AbckitCoreFunction *> nameToFunction;
for (auto &[functionName, functionImpl] : prog->functionTable) {
auto [moduleName, className] = FuncGetNames(functionName);
if (ShouldCreateFuncWrapper(functionImpl, className, functionName)) {
functions.emplace_back(CollectFunction(file, nameToModule, functionName, functionImpl));
nameToFunction[functionName] = functions.back().get();
}
}
AssignClasses(nameToModule, classes);
AssignFunctions(globalClassNames, nameToModule, nameToClass, functions);
// NOTE: AbckitCoreExportDescriptor
// NOTE: AbckitModulePayload
for (auto &[moduleName, module] : modulesMap) {
for (auto &[moduleName, module] : nameToModule) {
file->localModules.insert({moduleName, std::move(module)});
}
DumpHierarchy(file);
// Strings
for (auto &sImpl : prog->strings) {
auto s = std::make_unique<AbckitString>();

View File

@ -226,7 +226,7 @@ AbckitIsaApiDynamicOpcode GetDynamicOpcode(compiler::Inst *inst)
size_t GetIntrinicMaxInputsCount(AbckitInst *inst)
{
ASSERT(inst->impl->IsIntrinsic());
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
return GetIntrinicMaxInputsCountDyn(inst->impl->CastToIntrinsic());
}
return GetIntrinicMaxInputsCountStatic(inst->impl->CastToIntrinsic());
@ -234,7 +234,7 @@ size_t GetIntrinicMaxInputsCount(AbckitInst *inst)
bool IsCallInst(AbckitInst *inst)
{
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
return IsCallInstDyn(inst->impl);
}
return IsCallInstStatic(inst->impl);
@ -469,7 +469,7 @@ void SetLastError(AbckitStatus err)
uint32_t GetClassOffset(AbckitGraph *graph, AbckitCoreClass *klass)
{
ASSERT(!IsDynamic(graph->function->m->target));
ASSERT(!IsDynamic(graph->function->owningModule->target));
auto *rec = klass->GetArkTSImpl()->impl.GetStaticClass();
LIBABCKIT_LOG(DEBUG) << "className: " << rec->name << "\n";
@ -492,7 +492,7 @@ std::string GetFuncName(AbckitCoreFunction *function)
{
std::string funcName = "__ABCKIT_INVALID__";
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
auto *func = PandasmWrapper::GetWrappedFunction(GetDynFunction(function));
funcName = func->name;
delete func;
@ -508,7 +508,7 @@ std::string GetMangleFuncName(AbckitCoreFunction *function)
{
std::string funcName = "__ABCKIT_INVALID__";
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
auto *func = PandasmWrapper::GetWrappedFunction(GetDynFunction(function));
funcName = func->name;
delete func;
@ -568,7 +568,7 @@ uint32_t GetStringOffset(AbckitGraph *graph, AbckitString *string)
uint32_t GetLiteralArrayOffset(AbckitGraph *graph, AbckitLiteralArray *arr)
{
std::string arrName = "__ABCKIT_INVALID__";
if (IsDynamic(graph->function->m->target)) {
if (IsDynamic(graph->function->owningModule->target)) {
auto litarrTable = PandasmWrapper::GetUnwrappedLiteralArrayTable(graph->file->GetDynamicProgram());
for (auto &[id, s] : litarrTable) {
if (s == arr->GetDynamicImpl()) {

View File

@ -28,6 +28,7 @@
#include "libabckit/src/ir_impl.h"
#include "libabckit/src/wrappers/pandasm_wrapper.h"
#include "static_core/assembler/assembly-program.h"
#include "static_core/assembler/mangling.h"
#include "static_core/compiler/optimizer/ir/graph.h"
@ -214,6 +215,18 @@ AbckitBasicBlock *GgetBasicBlockStatic(AbckitGraph *graph, uint32_t id)
return graph->implToBB.at(bbImpl);
}
uint32_t GgetNumberOfParametersStatic(AbckitGraph *graph)
{
auto list = graph->impl->GetParameters();
auto ins = list.begin();
uint32_t size = 0;
while (ins != list.end()) {
++ins;
++size;
}
return size;
}
AbckitInst *GgetParameterStatic(AbckitGraph *graph, uint32_t index)
{
LIBABCKIT_LOG_FUNC;
@ -221,19 +234,22 @@ AbckitInst *GgetParameterStatic(AbckitGraph *graph, uint32_t index)
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
}
if (index >= GgetNumberOfParametersStatic(graph)) {
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
}
auto list = graph->impl->GetParameters();
auto ins = list.begin();
for (uint32_t i = 0; i < index; i++) {
if (ins != list.end()) {
++ins;
} else {
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
}
}
return graph->implToInst.at(*ins);
}
void SetTryBlocks(AbckitGraph *graph, AbckitBasicBlock *tryLastBB, AbckitBasicBlock *tryBeginBB,
AbckitBasicBlock *tryEndBB)
{
@ -340,7 +356,7 @@ void GinsertTryCatchStatic(AbckitBasicBlock *tryFirstBB, AbckitBasicBlock *tryLa
AbckitGraph *graph = tryFirstBB->graph;
// NOTE(nsizov): implement for static mode as well
if (!IsDynamic(graph->function->m->target)) {
if (!IsDynamic(graph->function->owningModule->target)) {
libabckit::statuses::SetLastError(ABCKIT_STATUS_WRONG_TARGET);
return;
}
@ -604,7 +620,7 @@ void BBeraseSuccBlockStatic(AbckitBasicBlock *bb, size_t index)
bb->impl->RemoveSucc(succ);
}
void BBclearStatic(AbckitBasicBlock *basicBlock)
void BBremoveAllInstsStatic(AbckitBasicBlock *basicBlock)
{
LIBABCKIT_LOG_FUNC;
LIBABCKIT_BAD_ARGUMENT_VOID(basicBlock)
@ -877,12 +893,12 @@ AbckitInst *BBcreatePhiStatic(AbckitBasicBlock *bb, size_t argCount, std::va_lis
}
compiler::DataType::Type type = inputs[0]->impl->GetType();
if (IsDynamic(bb->graph->function->m->target)) {
if (IsDynamic(bb->graph->function->owningModule->target)) {
type = compiler::DataType::ANY;
}
for (auto *inst : inputs) {
if (IsDynamic(bb->graph->function->m->target)) {
if (IsDynamic(bb->graph->function->owningModule->target)) {
if (inst->impl->GetType() != compiler::DataType::INT64 &&
inst->impl->GetType() != compiler::DataType::ANY) {
LIBABCKIT_LOG(DEBUG) << "inconsistent input types\n";
@ -907,6 +923,53 @@ AbckitInst *BBcreatePhiStatic(AbckitBasicBlock *bb, size_t argCount, std::va_lis
return phi;
}
AbckitInst *BBcreateCatchPhiStatic(AbckitBasicBlock *catchBegin, size_t argCount, std::va_list args)
{
auto *instImpl = catchBegin->graph->impl->CreateInstCatchPhi();
auto *catchPhi = CreateInstFromImpl(catchBegin->graph, instImpl);
BBaddInstFrontStatic(catchBegin, catchPhi);
if (argCount == 0) {
auto type = IsDynamic(catchBegin->graph->function->owningModule->target) ? compiler::DataType::ANY
: compiler::DataType::REFERENCE;
instImpl->SetIsAcc();
instImpl->SetType(type);
return catchPhi;
}
std::vector<compiler::DataType::Type> types;
for (size_t index = 0; index < argCount; ++index) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
AbckitInst *inputOrThrowable = va_arg(args, AbckitInst *);
if (index % 2U == 0) {
types.push_back(inputOrThrowable->impl->GetType());
catchPhi->impl->AppendInput(inputOrThrowable->impl);
} else {
catchPhi->impl->CastToCatchPhi()->AppendThrowableInst(inputOrThrowable->impl);
}
}
ASSERT(!types.empty());
if (IsDynamic(catchBegin->graph->function->owningModule->target)) {
catchPhi->impl->SetType(compiler::DataType::ANY);
} else {
for (int i = 1, j = types.size(); i < j; ++i) {
if (types[0] != types[i]) {
LIBABCKIT_LOG(DEBUG) << "All inputs of a catchPhi should be of the same type " << '\n';
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
catchBegin->impl->EraseInst(instImpl, true);
return nullptr;
}
}
catchPhi->impl->SetType(types[0]);
}
return catchPhi;
}
// ========================================
// Api for instruction manipulation
// ========================================
@ -933,7 +996,7 @@ AbckitLiteralArray *IgetLiteralArrayStatic(AbckitInst *inst)
{
LIBABCKIT_LOG_FUNC;
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasLiteralArrayIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -951,24 +1014,35 @@ AbckitLiteralArray *IgetLiteralArrayStatic(AbckitInst *inst)
auto &imms = inst->impl->CastToIntrinsic()->GetImms();
ASSERT(!imms.empty());
auto arrName = inst->graph->irInterface->literalarrays.at(imms[idx]);
auto litarr = std::make_unique<AbckitLiteralArray>();
litarr->file = inst->graph->file;
if (IsDynamic(inst->graph->function->m->target)) {
litarr->impl = reinterpret_cast<panda::pandasm::LiteralArray *>(
std::variant<ark::pandasm::LiteralArray *, panda::pandasm::LiteralArray *> arrImpl {
(panda::pandasm::LiteralArray *)nullptr};
if (IsDynamic(inst->graph->function->owningModule->target)) {
arrImpl = reinterpret_cast<panda::pandasm::LiteralArray *>(
PandasmWrapper::GetUnwrappedLiteralArrayTable(inst->graph->file->GetDynamicProgram()).at(arrName));
} else {
litarr->impl = reinterpret_cast<ark::pandasm::LiteralArray *>(
PandasmWrapper::GetUnwrappedLiteralArrayTable(inst->graph->file->GetStaticProgram()).at(arrName));
arrImpl = &inst->graph->file->GetStaticProgram()->literalarrayTable.at(arrName);
}
return inst->graph->file->litarrs.emplace_back(std::move(litarr)).get();
// Search through already created litarrs
auto &abckitLitArrs = inst->graph->file->litarrs;
for (auto &item : abckitLitArrs) {
if (item->impl == arrImpl) {
return item.get();
}
}
// Create new litarr
auto litarr = std::make_unique<AbckitLiteralArray>();
litarr->file = inst->graph->file;
litarr->impl = arrImpl;
return abckitLitArrs.emplace_back(std::move(litarr)).get();
}
void IsetLiteralArrayStatic(AbckitInst *inst, AbckitLiteralArray *la)
{
LIBABCKIT_LOG_FUNC;
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasLiteralArrayIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -993,7 +1067,7 @@ AbckitString *IgetStringStatic(AbckitInst *inst)
{
LIBABCKIT_LOG_FUNC;
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasStringIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1019,7 +1093,7 @@ void IsetStringStatic(AbckitInst *inst, AbckitString *str)
{
LIBABCKIT_LOG_FUNC;
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasStringIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1260,11 +1334,7 @@ void IappendInputStatic(AbckitInst *inst, AbckitInst *input)
static AbckitType *CreateGeneralType(AbckitFile *file, AbckitTypeId typeId, AbckitCoreClass *klass)
{
auto type = std::make_unique<AbckitType>();
type->id = typeId;
type->klass = klass;
file->types.emplace_back(std::move(type));
return file->types.back().get();
return GetOrCreateType(file, typeId, 0, klass);
}
AbckitType *IgetTypeStatic(AbckitInst *inst)
@ -1332,7 +1402,7 @@ AbckitCoreFunction *IgetFunctionStatic(AbckitInst *inst)
methodPtr = callInst->GetCallMethod();
} else if (inst->impl->IsIntrinsic()) {
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasMethodIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1382,7 +1452,7 @@ void IsetFunctionStatic(AbckitInst *inst, AbckitCoreFunction *function)
callInst->SetCallMethodId(methodOffset);
} else if (inst->impl->IsIntrinsic()) {
size_t idx = 0;
if (IsDynamic(inst->graph->function->m->target)) {
if (IsDynamic(inst->graph->function->owningModule->target)) {
auto instOpcode = GetDynamicOpcode(inst->impl);
if (!HasMethodIdOperandDynamic(instOpcode)) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1578,19 +1648,19 @@ AbckitCoreModule *IgetModuleStatic(AbckitInst *inst)
return nullptr;
}
return inst->graph->function->m->md[intrInst->GetImm(0)];
return inst->graph->function->owningModule->md[intrInst->GetImm(0)];
}
uint64_t GetModuleIndex(AbckitGraph *graph, AbckitCoreModule *md)
{
uint64_t imm = 0;
for (auto m : graph->function->m->md) {
for (auto m : graph->function->owningModule->md) {
if (m == md) {
break;
}
imm++;
}
if (imm == graph->function->m->md.size()) {
if (imm == graph->function->owningModule->md.size()) {
LIBABCKIT_LOG(DEBUG) << "Can not find module descriptor for module with name '" << md->moduleName->impl
<< "'\n";
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1627,7 +1697,7 @@ void IsetModuleStatic(AbckitInst *inst, AbckitCoreModule *md)
AbckitCoreImportDescriptor *GetImportDescriptorDynamic(AbckitInst *inst, uint64_t idx)
{
auto *module = inst->graph->function->m;
auto *module = inst->graph->function->owningModule;
for (auto &id : module->id) {
auto idPayload = GetDynImportDescriptorPayload(id.get());
if (!idPayload->isRegularImport) {
@ -1643,7 +1713,7 @@ AbckitCoreImportDescriptor *GetImportDescriptorDynamic(AbckitInst *inst, uint64_
AbckitCoreImportDescriptor *IgetImportDescriptorStatic(AbckitInst *inst)
{
LIBABCKIT_LOG_FUNC;
ASSERT(IsDynamic(inst->graph->function->m->target));
ASSERT(IsDynamic(inst->graph->function->owningModule->target));
if (!inst->impl->IsIntrinsic()) {
LIBABCKIT_LOG(DEBUG) << "Instruction doesn't have import descriptor\n";
@ -1665,7 +1735,7 @@ AbckitCoreImportDescriptor *IgetImportDescriptorStatic(AbckitInst *inst)
uint32_t GetImportDescriptorIdxDynamic(AbckitGraph *graph, AbckitCoreImportDescriptor *id)
{
AbckitCoreModule *m = graph->function->m;
AbckitCoreModule *m = graph->function->owningModule;
auto found = std::find_if(m->id.begin(), m->id.end(),
[&](std::unique_ptr<AbckitCoreImportDescriptor> const &d) { return d.get() == id; });
if (found == m->id.end()) {
@ -1679,7 +1749,7 @@ uint32_t GetImportDescriptorIdxDynamic(AbckitGraph *graph, AbckitCoreImportDescr
void IsetImportDescriptorStatic(AbckitInst *inst, AbckitCoreImportDescriptor *id)
{
LIBABCKIT_LOG_FUNC;
ASSERT(IsDynamic(inst->graph->function->m->target));
ASSERT(IsDynamic(inst->graph->function->owningModule->target));
if (!inst->impl->IsIntrinsic()) {
LIBABCKIT_LOG(DEBUG) << "Instruction doesn't have import descriptor\n";
@ -1705,7 +1775,7 @@ void IsetImportDescriptorStatic(AbckitInst *inst, AbckitCoreImportDescriptor *id
AbckitCoreExportDescriptor *GetExportDescriptorDynamic(AbckitInst *inst, uint64_t idx)
{
auto *module = inst->graph->function->m;
auto *module = inst->graph->function->owningModule;
for (auto &ed : module->ed) {
auto edPayload = GetDynExportDescriptorPayload(ed.get());
if (edPayload->kind != AbckitDynamicExportKind::ABCKIT_DYNAMIC_EXPORT_KIND_LOCAL_EXPORT) {
@ -1721,7 +1791,7 @@ AbckitCoreExportDescriptor *GetExportDescriptorDynamic(AbckitInst *inst, uint64_
AbckitCoreExportDescriptor *IgetExportDescriptorStatic(AbckitInst *inst)
{
LIBABCKIT_LOG_FUNC;
ASSERT(IsDynamic(inst->graph->function->m->target));
ASSERT(IsDynamic(inst->graph->function->owningModule->target));
if (!inst->impl->IsIntrinsic()) {
LIBABCKIT_LOG(DEBUG) << "Instruction doesn't have export descriptor\n";
@ -1745,7 +1815,7 @@ AbckitCoreExportDescriptor *IgetExportDescriptorStatic(AbckitInst *inst)
uint32_t GetExportDescriptorIdxDynamic(AbckitGraph *graph, AbckitCoreExportDescriptor *ed)
{
AbckitCoreModule *m = graph->function->m;
AbckitCoreModule *m = graph->function->owningModule;
auto found = std::find_if(m->ed.begin(), m->ed.end(),
[&](std::unique_ptr<AbckitCoreExportDescriptor> const &d) { return d.get() == ed; });
if (found == m->ed.end()) {
@ -1759,7 +1829,7 @@ uint32_t GetExportDescriptorIdxDynamic(AbckitGraph *graph, AbckitCoreExportDescr
void IsetExportDescriptorStatic(AbckitInst *inst, AbckitCoreExportDescriptor *ed)
{
LIBABCKIT_LOG_FUNC;
ASSERT(IsDynamic(inst->graph->function->m->target));
ASSERT(IsDynamic(inst->graph->function->owningModule->target));
if (!inst->impl->IsIntrinsic()) {
LIBABCKIT_LOG(DEBUG) << "Instruction doesn't have export descriptor\n";

View File

@ -33,6 +33,7 @@ namespace libabckit {
AbckitBasicBlock *GgetStartBasicBlockStatic(AbckitGraph *graph);
AbckitBasicBlock *GgetEndBasicBlockStatic(AbckitGraph *graph);
AbckitBasicBlock *GgetBasicBlockStatic(AbckitGraph *graph, uint32_t id);
uint32_t GgetNumberOfParametersStatic(AbckitGraph *graph);
AbckitInst *GgetParameterStatic(AbckitGraph *graph, uint32_t index);
void GinsertTryCatchStatic(AbckitBasicBlock *tryFirstBB, AbckitBasicBlock *tryLastBB, AbckitBasicBlock *catchBeginBB,
AbckitBasicBlock *catchEndBB);
@ -67,7 +68,7 @@ uint64_t BBgetPredBlockCountStatic(AbckitBasicBlock *basicBlock);
uint32_t BBgetIdStatic(AbckitBasicBlock *basicBlock);
uint32_t BBgetNumberOfInstructionsStatic(AbckitBasicBlock *basicBlock);
AbckitBasicBlock *BBsplitBlockAfterInstructionStatic(AbckitInst *inst, bool makeEdge);
void BBclearStatic(AbckitBasicBlock *basicBlock);
void BBremoveAllInstsStatic(AbckitBasicBlock *basicBlock);
void BBaddInstFrontStatic(AbckitBasicBlock *basicBlock, AbckitInst *inst);
void BBaddInstBackStatic(AbckitBasicBlock *basicBlock, AbckitInst *inst);
void BBdumpStatic(AbckitBasicBlock *basicBlock, int fd);
@ -85,6 +86,7 @@ bool BBisCatchBeginStatic(AbckitBasicBlock *basicBlock);
bool BBisCatchStatic(AbckitBasicBlock *basicBlock);
bool BBcheckDominanceStatic(AbckitBasicBlock *basicBlock, AbckitBasicBlock *dominator);
AbckitInst *BBcreatePhiStatic(AbckitBasicBlock *bb, size_t argCount, std::va_list args);
AbckitInst *BBcreateCatchPhiStatic(AbckitBasicBlock *catchBegin, size_t argCount, std::va_list args);
// ========================================
// Api for instruction manipulation
@ -152,7 +154,6 @@ AbckitInst *IcreateThrowStatic(AbckitGraph *graph, AbckitInst *input0);
AbckitInst *IcreateReturnStatic(AbckitGraph *graph, AbckitInst *input0);
AbckitInst *IcreateReturnVoidStatic(AbckitGraph *graph);
AbckitInst *IcreateCatchPhiStatic(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, std::va_list args);
AbckitInst *GcreateNullPtrStatic(AbckitGraph *graph);
int32_t IgetConstantValueI32Static(AbckitInst *inst);

View File

@ -50,14 +50,14 @@ using namespace ark;
AbckitInst *IcreateDynCallthis0Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_CALLTHIS0_IMM8_V8);
}
AbckitInst *IcreateDynCallthis1Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_CALLTHIS1_IMM8_V8_V8);
}
@ -70,7 +70,7 @@ AbckitInst *IcreateDynCallarg0Static(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynCallarg1Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_CALLARG1_IMM8_V8);
}
@ -91,7 +91,7 @@ AbckitInst *IcreateDynLdobjbynameStatic(AbckitGraph *graph, AbckitInst *acc, Abc
AbckitInst *IcreateDynNewobjrangeStatic(AbckitGraph *graph, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, argCount, args, compiler::IntrinsicInst::IntrinsicId::DYN_NEWOBJRANGE_IMM16_IMM8_V8);
}
@ -111,63 +111,63 @@ AbckitInst *IcreateDynNegStatic(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynAdd2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ADD2_IMM8_V8);
}
AbckitInst *IcreateDynSub2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SUB2_IMM8_V8);
}
AbckitInst *IcreateDynMul2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_MUL2_IMM8_V8);
}
AbckitInst *IcreateDynDiv2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_DIV2_IMM8_V8);
}
AbckitInst *IcreateDynMod2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_MOD2_IMM8_V8);
}
AbckitInst *IcreateDynExpStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_EXP_IMM8_V8);
}
AbckitInst *IcreateDynShl2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SHL2_IMM8_V8);
}
AbckitInst *IcreateDynShr2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SHR2_IMM8_V8);
}
AbckitInst *IcreateDynAshr2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ASHR2_IMM8_V8);
}
@ -180,21 +180,21 @@ AbckitInst *IcreateDynNotStatic(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynOr2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_OR2_IMM8_V8);
}
AbckitInst *IcreateDynXor2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_XOR2_IMM8_V8);
}
AbckitInst *IcreateDynAnd2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_AND2_IMM8_V8);
}
@ -213,56 +213,56 @@ AbckitInst *IcreateDynDecStatic(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynEqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_EQ_IMM8_V8);
}
AbckitInst *IcreateDynNoteqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_NOTEQ_IMM8_V8);
}
AbckitInst *IcreateDynLessStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_LESS_IMM8_V8);
}
AbckitInst *IcreateDynLesseqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_LESSEQ_IMM8_V8);
}
AbckitInst *IcreateDynGreaterStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_GREATER_IMM8_V8);
}
AbckitInst *IcreateDynGreatereqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_GREATEREQ_IMM8_V8);
}
AbckitInst *IcreateDynStrictnoteqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_STRICTNOTEQ_IMM8_V8);
}
AbckitInst *IcreateDynStricteqStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_STRICTEQ_IMM8_V8);
}
@ -317,21 +317,21 @@ AbckitInst *IcreateDynThrowDeletesuperpropertyStatic(AbckitGraph *graph)
AbckitInst *IcreateDynThrowConstassignmentStatic(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, compiler::IntrinsicInst::IntrinsicId::DYN_THROW_CONSTASSIGNMENT_PREF_V8);
}
AbckitInst *IcreateDynThrowIfnotobjectStatic(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, compiler::IntrinsicInst::IntrinsicId::DYN_THROW_IFNOTOBJECT_PREF_V8);
}
AbckitInst *IcreateDynThrowUndefinedifholeStatic(AbckitGraph *graph, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, input1,
compiler::IntrinsicInst::IntrinsicId::DYN_THROW_UNDEFINEDIFHOLE_PREF_V8_V8);
}
@ -363,7 +363,7 @@ AbckitInst *IcreateDynDefineclasswithbufferStatic(AbckitGraph *graph, AbckitCore
AbckitLiteralArray *literalArray, uint64_t imm0, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, GetMethodOffset(graph, function), GetLiteralArrayOffset(graph, literalArray), imm0,
input0,
compiler::IntrinsicInst::IntrinsicId::DYN_DEFINECLASSWITHBUFFER_IMM16_ID16_ID16_IMM16_V8);
@ -374,7 +374,7 @@ AbckitInst *IcreateDynCallruntimeDefinesendableclassStatic(AbckitGraph *graph, A
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(
graph, GetMethodOffset(graph, function), GetLiteralArrayOffset(graph, literalArray), imm0, input0,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLRUNTIME_DEFINESENDABLECLASS_PREF_IMM16_ID16_ID16_IMM16_V8);
@ -461,14 +461,14 @@ AbckitInst *IcreateDynTypeofStatic(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynIsinStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ISIN_IMM8_V8);
}
AbckitInst *IcreateDynInstanceofStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_INSTANCEOF_IMM8_V8);
}
@ -487,7 +487,7 @@ AbckitInst *IcreateDynReturnundefinedStatic(AbckitGraph *graph)
AbckitInst *IcreateDynStownbynameStatic(AbckitGraph *graph, AbckitInst *acc, AbckitString *string, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_STOWNBYNAME_IMM16_ID16_V8);
}
@ -495,14 +495,14 @@ AbckitInst *IcreateDynStownbynameStatic(AbckitGraph *graph, AbckitInst *acc, Abc
AbckitInst *IcreateDynStownbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_STOWNBYVALUE_IMM8_V8_V8);
}
AbckitInst *IcreateDynStownbyindexStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, uint64_t imm0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0,
compiler::IntrinsicInst::IntrinsicId::DYN_STOWNBYINDEX_IMM16_V8_IMM16);
}
@ -510,7 +510,7 @@ AbckitInst *IcreateDynStownbyindexStatic(AbckitGraph *graph, AbckitInst *acc, Ab
AbckitInst *IcreateDynWideStownbyindexStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, uint64_t imm0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_STOWNBYINDEX_PREF_V8_IMM32, false);
}
@ -519,7 +519,7 @@ AbckitInst *IcreateDynStownbyvaluewithnamesetStatic(AbckitGraph *graph, AbckitIn
AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1,
compiler::IntrinsicInst::IntrinsicId::DYN_STOWNBYVALUEWITHNAMESET_IMM16_V8_V8);
}
@ -528,7 +528,7 @@ AbckitInst *IcreateDynStownbynamewithnamesetStatic(AbckitGraph *graph, AbckitIns
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_STOWNBYNAMEWITHNAMESET_IMM8_ID16_V8);
}
@ -542,7 +542,7 @@ AbckitInst *IcreateDynCreateemptyobjectStatic(AbckitGraph *graph)
AbckitInst *IcreateDynStobjbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1,
compiler::IntrinsicInst::IntrinsicId::DYN_STOBJBYVALUE_IMM16_V8_V8);
}
@ -550,7 +550,7 @@ AbckitInst *IcreateDynStobjbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, Ab
AbckitInst *IcreateDynStobjbyindexStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, uint64_t imm0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0,
compiler::IntrinsicInst::IntrinsicId::DYN_STOBJBYINDEX_IMM8_V8_IMM16);
}
@ -558,7 +558,7 @@ AbckitInst *IcreateDynStobjbyindexStatic(AbckitGraph *graph, AbckitInst *acc, Ab
AbckitInst *IcreateDynWideStobjbyindexStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, uint64_t imm0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_STOBJBYINDEX_PREF_V8_IMM32, false);
}
@ -566,7 +566,7 @@ AbckitInst *IcreateDynWideStobjbyindexStatic(AbckitGraph *graph, AbckitInst *acc
AbckitInst *IcreateDynStobjbynameStatic(AbckitGraph *graph, AbckitInst *acc, AbckitString *string, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_STOBJBYNAME_IMM16_ID16_V8);
}
@ -622,14 +622,14 @@ AbckitInst *IcreateDynGetasynciteratorStatic(AbckitGraph *graph, AbckitInst *acc
AbckitInst *IcreateDynCreategeneratorobjStatic(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, compiler::IntrinsicInst::IntrinsicId::DYN_CREATEGENERATOROBJ_V8);
}
AbckitInst *IcreateDynCreateasyncgeneratorobjStatic(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, compiler::IntrinsicInst::IntrinsicId::DYN_CREATEASYNCGENERATOROBJ_V8);
}
@ -667,7 +667,7 @@ AbckitInst *IcreateDynGettemplateobjectStatic(AbckitGraph *graph, AbckitInst *ac
AbckitInst *IcreateDynGetnextpropnameStatic(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, compiler::IntrinsicInst::IntrinsicId::DYN_GETNEXTPROPNAME_V8, false);
}
@ -688,21 +688,21 @@ AbckitInst *IcreateDynDynamicimportStatic(AbckitGraph *graph, AbckitInst *acc)
AbckitInst *IcreateDynCreateiterresultobjStatic(AbckitGraph *graph, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_CREATEITERRESULTOBJ_V8_V8);
}
AbckitInst *IcreateDynNewobjapplyStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_NEWOBJAPPLY_IMM16_V8);
}
AbckitInst *IcreateDynCallruntimeCallinitStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLRUNTIME_CALLINIT_PREF_IMM8_V8);
}
@ -710,84 +710,84 @@ AbckitInst *IcreateDynCallruntimeCallinitStatic(AbckitGraph *graph, AbckitInst *
AbckitInst *IcreateDynSupercallspreadStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SUPERCALLSPREAD_IMM8_V8);
}
AbckitInst *IcreateDynDelobjpropStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_DELOBJPROP_V8);
}
AbckitInst *IcreateDynSuspendgeneratorStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SUSPENDGENERATOR_V8);
}
AbckitInst *IcreateDynAsyncfunctionawaituncaughtStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ASYNCFUNCTIONAWAITUNCAUGHT_V8);
}
AbckitInst *IcreateDynCopydatapropertiesStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_COPYDATAPROPERTIES_V8);
}
AbckitInst *IcreateDynSetobjectwithprotoStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_SETOBJECTWITHPROTO_IMM16_V8);
}
AbckitInst *IcreateDynLdobjbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_LDOBJBYVALUE_IMM16_V8);
}
AbckitInst *IcreateDynLdsuperbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_LDSUPERBYVALUE_IMM16_V8);
}
AbckitInst *IcreateDynAsyncfunctionresolveStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ASYNCFUNCTIONRESOLVE_V8);
}
AbckitInst *IcreateDynAsyncfunctionrejectStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ASYNCFUNCTIONREJECT_V8);
}
AbckitInst *IcreateDynStthisbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_STTHISBYVALUE_IMM8_V8);
}
AbckitInst *IcreateDynAsyncgeneratorrejectStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, compiler::IntrinsicInst::IntrinsicId::DYN_ASYNCGENERATORREJECT_V8);
}
@ -796,28 +796,28 @@ AbckitInst *IcreateDynAsyncgeneratorrejectStatic(AbckitGraph *graph, AbckitInst
AbckitInst *IcreateDynCallargs2Static(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_CALLARGS2_IMM8_V8_V8);
}
AbckitInst *IcreateDynApplyStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_APPLY_IMM8_V8_V8);
}
AbckitInst *IcreateDynStarrayspreadStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, compiler::IntrinsicInst::IntrinsicId::DYN_STARRAYSPREAD_V8_V8);
}
AbckitInst *IcreateDynStsuperbyvalueStatic(AbckitGraph *graph, AbckitInst *acc, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1,
compiler::IntrinsicInst::IntrinsicId::DYN_STSUPERBYVALUE_IMM16_V8_V8);
}
@ -826,7 +826,7 @@ AbckitInst *IcreateDynAsyncgeneratorresolveStatic(AbckitGraph *graph, AbckitInst
AbckitInst *input2)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, input1, input2,
compiler::IntrinsicInst::IntrinsicId::DYN_ASYNCGENERATORRESOLVE_V8_V8_V8);
}
@ -835,7 +835,7 @@ AbckitInst *IcreateDynCallruntimeDefinefieldbyvalueStatic(AbckitGraph *graph, Ab
AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLRUNTIME_DEFINEFIELDBYVALUE_PREF_IMM8_V8_V8);
}
@ -844,7 +844,7 @@ AbckitInst *IcreateDynDefinefieldbynameStatic(AbckitGraph *graph, AbckitInst *ac
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_DEFINEFIELDBYNAME_IMM8_ID16_V8);
}
@ -853,7 +853,7 @@ AbckitInst *IcreateDynDefinepropertybynameStatic(AbckitGraph *graph, AbckitInst
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_DEFINEPROPERTYBYNAME_IMM8_ID16_V8);
}
@ -861,7 +861,7 @@ AbckitInst *IcreateDynDefinepropertybynameStatic(AbckitGraph *graph, AbckitInst
AbckitInst *IcreateDynStsuperbynameStatic(AbckitGraph *graph, AbckitInst *acc, AbckitString *string, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, GetStringOffset(graph, string),
compiler::IntrinsicInst::IntrinsicId::DYN_STSUPERBYNAME_IMM16_ID16_V8);
}
@ -870,7 +870,7 @@ AbckitInst *IcreateDynCreateobjectwithexcludedkeysStatic(AbckitGraph *graph, Abc
uint64_t imm0, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, input1, imm0, args,
compiler::IntrinsicInst::IntrinsicId::DYN_CREATEOBJECTWITHEXCLUDEDKEYS_IMM8_V8_V8, false);
}
@ -879,7 +879,7 @@ AbckitInst *IcreateDynWideCreateobjectwithexcludedkeysStatic(AbckitGraph *graph,
uint64_t imm0, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, input0, input1, imm0, args,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_CREATEOBJECTWITHEXCLUDEDKEYS_PREF_IMM16_V8_V8,
false);
@ -889,7 +889,7 @@ AbckitInst *IcreateDynCallruntimeDefinefieldbyindexStatic(AbckitGraph *graph, Ab
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLRUNTIME_DEFINEFIELDBYINDEX_PREF_IMM8_IMM32_V8);
}
@ -897,7 +897,7 @@ AbckitInst *IcreateDynCallruntimeDefinefieldbyindexStatic(AbckitGraph *graph, Ab
AbckitInst *IcreateDynCallthisrangeStatic(AbckitGraph *graph, AbckitInst *acc, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
auto intrImpl = graph->impl->CreateInstIntrinsic(
compiler::DataType::ANY, 0, compiler::IntrinsicInst::IntrinsicId::DYN_CALLTHISRANGE_IMM8_IMM8_V8);
size_t argsCount {argCount + 2};
@ -917,7 +917,7 @@ AbckitInst *IcreateDynCallthisrangeStatic(AbckitGraph *graph, AbckitInst *acc, s
AbckitInst *IcreateDynWideCallthisrangeStatic(AbckitGraph *graph, AbckitInst *acc, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
auto intrImpl = graph->impl->CreateInstIntrinsic(
compiler::DataType::ANY, 0, compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_CALLTHISRANGE_PREF_IMM16_V8);
size_t argsCount {argCount + 2};
@ -936,7 +936,7 @@ AbckitInst *IcreateDynWideCallthisrangeStatic(AbckitGraph *graph, AbckitInst *ac
AbckitInst *IcreateDynSupercallarrowrangeStatic(AbckitGraph *graph, AbckitInst *acc, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_SUPERCALLARROWRANGE_IMM8_IMM8_V8);
}
@ -944,14 +944,14 @@ AbckitInst *IcreateDynSupercallarrowrangeStatic(AbckitGraph *graph, AbckitInst *
AbckitInst *IcreateDynCallrangeStatic(AbckitGraph *graph, AbckitInst *acc, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, argCount, args, compiler::IntrinsicInst::IntrinsicId::DYN_CALLRANGE_IMM8_IMM8_V8);
}
AbckitInst *IcreateDynWideCallrangeStatic(AbckitGraph *graph, AbckitInst *acc, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_CALLRANGE_PREF_IMM16_V8, false);
}
@ -960,7 +960,7 @@ AbckitInst *IcreateDynWideSupercallarrowrangeStatic(AbckitGraph *graph, AbckitIn
std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_SUPERCALLARROWRANGE_PREF_IMM16_V8, false);
}
@ -969,7 +969,7 @@ AbckitInst *IcreateDynStprivatepropertyStatic(AbckitGraph *graph, AbckitInst *ac
AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, imm0, imm1,
compiler::IntrinsicInst::IntrinsicId::DYN_STPRIVATEPROPERTY_IMM8_IMM16_IMM16_V8);
}
@ -977,7 +977,7 @@ AbckitInst *IcreateDynCallruntimeDefineprivatepropertyStatic(AbckitGraph *graph,
uint64_t imm1, AbckitInst *input0)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(
graph, acc, input0, imm0, imm1,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLRUNTIME_DEFINEPRIVATEPROPERTY_PREF_IMM8_IMM16_IMM16_V8);
@ -1001,7 +1001,7 @@ AbckitInst *IcreateDynCallargs3Static(AbckitGraph *graph, AbckitInst *acc, Abcki
AbckitInst *input2)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, input2,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLARGS3_IMM8_V8_V8_V8);
}
@ -1010,7 +1010,7 @@ AbckitInst *IcreateDynCallthis2Static(AbckitGraph *graph, AbckitInst *acc, Abcki
AbckitInst *input2)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, input2,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLTHIS2_IMM8_V8_V8_V8);
}
@ -1020,7 +1020,7 @@ AbckitInst *IcreateDynCallthis3Static(AbckitGraph *graph, AbckitInst *acc, Abcki
AbckitInst *input2, AbckitInst *input3)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, input2, input3,
compiler::IntrinsicInst::IntrinsicId::DYN_CALLTHIS3_IMM8_V8_V8_V8_V8);
}
@ -1030,7 +1030,7 @@ AbckitInst *IcreateDynDefinegettersetterbyvalueStatic(AbckitGraph *graph, Abckit
AbckitInst *input1, AbckitInst *input2, AbckitInst *input3)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, acc, input0, input1, input2, input3,
compiler::IntrinsicInst::IntrinsicId::DYN_DEFINEGETTERSETTERBYVALUE_V8_V8_V8_V8);
}
@ -1129,7 +1129,7 @@ AbckitInst *IcreateDynWideLdobjbyindexStatic(AbckitGraph *graph, AbckitInst *acc
AbckitInst *IcreateDynSupercallthisrangeStatic(AbckitGraph *graph, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_SUPERCALLTHISRANGE_IMM8_IMM8_V8);
}
@ -1137,7 +1137,7 @@ AbckitInst *IcreateDynSupercallthisrangeStatic(AbckitGraph *graph, size_t argCou
AbckitInst *IcreateDynWideSupercallthisrangeStatic(AbckitGraph *graph, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_SUPERCALLTHISRANGE_PREF_IMM16_V8, false);
}
@ -1145,7 +1145,7 @@ AbckitInst *IcreateDynWideSupercallthisrangeStatic(AbckitGraph *graph, size_t ar
AbckitInst *IcreateDynWideNewobjrangeStatic(AbckitGraph *graph, size_t argCount, std::va_list args)
{
LIBABCKIT_LOG_FUNC;
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
return CreateDynInst(graph, argCount, args,
compiler::IntrinsicInst::IntrinsicId::DYN_WIDE_NEWOBJRANGE_PREF_IMM16_V8, false);
}
@ -1509,7 +1509,7 @@ AbckitInst *IcreateLoadArrayStatic(AbckitGraph *graph, AbckitInst *arrayRef, Abc
LIBABCKIT_LOG_FUNC;
LIBABCKIT_LOG(DEBUG) << "IcreateLoadArrayStatic" << '\n';
if (returnTypeId == ABCKIT_TYPE_ID_INVALID || IsDynamic(graph->function->m->target) ||
if (returnTypeId == ABCKIT_TYPE_ID_INVALID || IsDynamic(graph->function->owningModule->target) ||
arrayRef->impl->GetType() != compiler::DataType::REFERENCE ||
(idx->impl->GetType() != compiler::DataType::INT32 && idx->impl->GetType() != compiler::DataType::INT64)) {
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
@ -1534,7 +1534,7 @@ static AbckitInst *IcreateStoreArrayBody(AbckitInst *arrayRef, AbckitInst *idx,
AbckitTypeId valueTypeId, bool isWide)
{
auto *graph = arrayRef->graph;
if (valueTypeId == ABCKIT_TYPE_ID_INVALID || IsDynamic(graph->function->m->target) ||
if (valueTypeId == ABCKIT_TYPE_ID_INVALID || IsDynamic(graph->function->owningModule->target) ||
arrayRef->impl->GetType() != compiler::DataType::REFERENCE) {
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
@ -1593,7 +1593,7 @@ AbckitInst *IcreateLenArrayStatic(AbckitGraph *graph, AbckitInst *arr)
LIBABCKIT_LOG_FUNC;
LIBABCKIT_LOG(DEBUG) << "IcreateLenArrayStatic" << '\n';
if (IsDynamic(graph->function->m->target) || arr->impl->GetType() != compiler::DataType::REFERENCE) {
if (IsDynamic(graph->function->owningModule->target) || arr->impl->GetType() != compiler::DataType::REFERENCE) {
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
}
@ -1703,52 +1703,6 @@ AbckitInst *IcreateThrowStatic(AbckitGraph *graph, AbckitInst *input0)
return CreateInstFromImpl(graph, intrImpl);
}
AbckitInst *IcreateCatchPhiStatic(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, std::va_list args)
{
auto *instImpl = graph->impl->CreateInstCatchPhi();
auto *catchPhi = CreateInstFromImpl(graph, instImpl);
BBaddInstFrontStatic(catchBegin, catchPhi);
if (argCount == 0) {
auto type = IsDynamic(graph->function->m->target) ? compiler::DataType::ANY : compiler::DataType::REFERENCE;
instImpl->SetIsAcc();
instImpl->SetType(type);
return catchPhi;
}
std::vector<compiler::DataType::Type> types;
for (size_t index = 0; index < argCount; ++index) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
AbckitInst *inputOrThrowable = va_arg(args, AbckitInst *);
if (index % 2U == 0) {
types.push_back(inputOrThrowable->impl->GetType());
catchPhi->impl->AppendInput(inputOrThrowable->impl);
} else {
catchPhi->impl->CastToCatchPhi()->AppendThrowableInst(inputOrThrowable->impl);
}
}
ASSERT(!types.empty());
if (IsDynamic(graph->function->m->target)) {
catchPhi->impl->SetType(compiler::DataType::ANY);
} else {
for (int i = 1, j = types.size(); i < j; ++i) {
if (types[0] != types[i]) {
LIBABCKIT_LOG(DEBUG) << "All inputs of a catchPhi should be of the same type " << '\n';
SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
catchBegin->impl->EraseInst(instImpl, true);
return nullptr;
}
}
catchPhi->impl->SetType(types[0]);
}
return catchPhi;
}
AbckitInst *IcreateSubStatic(AbckitGraph *graph, AbckitInst *input0, AbckitInst *input1)
{
LIBABCKIT_LOG_FUNC;
@ -1994,7 +1948,8 @@ AbckitInst *IcreateLoadStringStatic(AbckitGraph *graph, AbckitString *str)
LIBABCKIT_LOG_FUNC;
LIBABCKIT_LOG(DEBUG) << GetStringOffset(graph, str) << '\n';
auto intrinsicId = compiler::RuntimeInterface::IntrinsicId::INTRINSIC_ABCKIT_LOAD_STRING;
auto dataType = IsDynamic(graph->function->m->target) ? compiler::DataType::ANY : compiler::DataType::REFERENCE;
auto dataType =
IsDynamic(graph->function->owningModule->target) ? compiler::DataType::ANY : compiler::DataType::REFERENCE;
auto loadStringImpl = graph->impl->CreateInstIntrinsic(dataType, 0, intrinsicId);
auto *loadString = CreateInstFromImpl(graph, loadStringImpl);
loadStringImpl->AddImm(graph->impl->GetAllocator(), GetStringOffset(graph, str));

View File

@ -17,6 +17,7 @@
#include "libabckit/src/adapter_static/metadata_inspect_static.h"
#include "assembler/annotation.h"
#include "libabckit/include/c/statuses.h"
#include "libabckit/src/helpers_common.h"
#include "libabckit/src/macros.h"
#include "libabckit/src/metadata_inspect_impl.h"
#include "libabckit/src/ir_impl.h"
@ -41,7 +42,7 @@
#include <cstdint>
#include <iostream>
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;
@ -81,7 +82,7 @@ AbckitString *ClassGetNameStatic(AbckitCoreClass *klass)
auto *record = klass->GetArkTSImpl()->impl.GetStaticClass();
auto [moduleName, className] = ClassGetNames(record->name);
return CreateStringStatic(klass->m->file, className.data());
return CreateStringStatic(klass->owningModule->file, className.data());
}
// ========================================
@ -94,7 +95,7 @@ AbckitString *FunctionGetNameStatic(AbckitCoreFunction *function)
auto functionName = pandasm::MangleFunctionName(functionImpl->name, functionImpl->params, functionImpl->returnType);
auto croppedName = FuncNameCropModule(functionName);
return CreateStringStatic(function->m->file, croppedName.data());
return CreateStringStatic(function->owningModule->file, croppedName.data());
}
bool SetMethodOffset(pandasm::Function *func, pandasm::AsmEmitter::PandaFileToPandaAsmMaps *maps,
@ -150,7 +151,7 @@ static AbckitGraph *CreateGraph(AbckitCoreFunction *function, AbckitIrInterface
ark::compiler::Graph *graphImpl, AbckitRuntimeAdapterStatic *adapter)
{
auto graph = new AbckitGraph;
graph->file = function->m->file;
graph->file = function->owningModule->file;
graph->function = function;
graph->irInterface = irInterface;
graph->impl = graphImpl;
@ -173,7 +174,7 @@ AbckitGraph *CreateGraphFromFunctionStatic(AbckitCoreFunction *function)
LIBABCKIT_LOG_DUMP(func->DebugDump(), DEBUG);
LIBABCKIT_LOG(DEBUG) << func->name << '\n';
auto *file = function->m->file;
auto *file = function->owningModule->file;
auto program = file->GetStaticProgram();
auto maps = std::make_unique<pandasm::AsmEmitter::PandaFileToPandaAsmMaps>();
@ -438,35 +439,34 @@ AbckitType *ValueGetTypeStatic(AbckitValue *value)
{
LIBABCKIT_LOG_FUNC;
auto *pVal = static_cast<pandasm::ScalarValue *>(value->GetStaticImpl());
auto type = std::make_unique<AbckitType>();
type->klass = nullptr; // NOTE implement logic for classes
AbckitTypeId id;
switch (pVal->GetType()) {
case pandasm::Value::Type::U1:
type->id = ABCKIT_TYPE_ID_U1;
id = ABCKIT_TYPE_ID_U1;
break;
case pandasm::Value::Type::U8:
type->id = ABCKIT_TYPE_ID_U8;
id = ABCKIT_TYPE_ID_U8;
break;
case pandasm::Value::Type::U16:
type->id = ABCKIT_TYPE_ID_U16;
id = ABCKIT_TYPE_ID_U16;
break;
case pandasm::Value::Type::U32:
type->id = ABCKIT_TYPE_ID_U32;
id = ABCKIT_TYPE_ID_U32;
break;
case pandasm::Value::Type::U64:
type->id = ABCKIT_TYPE_ID_U64;
id = ABCKIT_TYPE_ID_U64;
break;
case pandasm::Value::Type::F64:
type->id = ABCKIT_TYPE_ID_F64;
id = ABCKIT_TYPE_ID_F64;
break;
case pandasm::Value::Type::STRING:
type->id = ABCKIT_TYPE_ID_STRING;
id = ABCKIT_TYPE_ID_STRING;
break;
default:
LIBABCKIT_UNIMPLEMENTED;
}
value->file->types.emplace_back(std::move(type));
return value->file->types.back().get();
// NOTE implement logic for classes
return GetOrCreateType(value->file, id, 0, nullptr);
}
bool ValueGetU1Static(AbckitValue *value)

View File

@ -36,7 +36,7 @@
#include <cstdint>
#include <string>
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;
@ -248,8 +248,7 @@ AbckitLiteralArray *CreateLiteralArrayStatic(AbckitFile *file, AbckitLiteral **v
// NOLINTNEXTLINE(cert-msc51-cpp)
uint32_t arrayOffset = 0;
while (prog->literalarrayTable.find(std::to_string(arrayOffset)) != prog->literalarrayTable.end()) {
LIBABCKIT_LOG(DEBUG) << "generating new arrayOffset\n";
arrayOffset = std::stoi(prog->literalarrayTable.rbegin()->first) + 1;
arrayOffset++;
}
auto arrayName = std::to_string(arrayOffset);

View File

@ -18,7 +18,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;

View File

@ -17,18 +17,13 @@
#include "generated/generate_ecma.inl"
#include "static_core/runtime/include/coretypes/tagged_value.h"
// CC-OFFNXT(G.INC.08-CPP) generated file requires namespace
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;
namespace libabckit {
void DoLda(compiler::Register reg, std::vector<InsWrapper> &result)
void DoLda(ark::compiler::Register reg, std::vector<InsWrapper> &result)
{
if (reg != compiler::GetAccReg()) {
if (reg > compiler::INVALID_REG) {
ASSERT(compiler::IsFrameSizeLarge());
if (reg != ark::compiler::GetAccReg()) {
if (reg > ark::compiler::INVALID_REG) {
ASSERT(ark::compiler::IsFrameSizeLarge());
result.emplace_back(PandasmWrapper::Create_MOV_Wrapper(CodeGenDynamic::RESERVED_REG, reg));
result.emplace_back(PandasmWrapper::Create_LDA_Wrapper(CodeGenDynamic::RESERVED_REG));
} else {
@ -37,11 +32,11 @@ void DoLda(compiler::Register reg, std::vector<InsWrapper> &result)
}
}
void DoSta(compiler::Register reg, std::vector<InsWrapper> &result)
void DoSta(ark::compiler::Register reg, std::vector<InsWrapper> &result)
{
if (reg != compiler::GetAccReg()) {
if (reg > compiler::INVALID_REG) {
ASSERT(compiler::IsFrameSizeLarge());
if (reg != ark::compiler::GetAccReg()) {
if (reg > ark::compiler::INVALID_REG) {
ASSERT(ark::compiler::IsFrameSizeLarge());
result.emplace_back(PandasmWrapper::Create_STA_Wrapper(CodeGenDynamic::RESERVED_REG));
result.emplace_back(PandasmWrapper::Create_MOV_Wrapper(reg, CodeGenDynamic::RESERVED_REG));
} else {
@ -50,9 +45,10 @@ void DoSta(compiler::Register reg, std::vector<InsWrapper> &result)
}
}
void CodeGenDynamic::AppendCatchBlock(uint32_t typeId, const compiler::BasicBlock *tryBegin,
const compiler::BasicBlock *tryEnd, const compiler::BasicBlock *catchBegin,
const compiler::BasicBlock *catchEnd)
void CodeGenDynamic::AppendCatchBlock(uint32_t typeId, const ark::compiler::BasicBlock *tryBegin,
const ark::compiler::BasicBlock *tryEnd,
const ark::compiler::BasicBlock *catchBegin,
const ark::compiler::BasicBlock *catchEnd)
{
auto cb = FunctionWrapper::CatchBlockWrapper();
if (typeId != 0) {
@ -65,7 +61,7 @@ void CodeGenDynamic::AppendCatchBlock(uint32_t typeId, const compiler::BasicBloc
catchBlocks_.emplace_back(cb);
}
void CodeGenDynamic::VisitTryBegin(const compiler::BasicBlock *bb)
void CodeGenDynamic::VisitTryBegin(const ark::compiler::BasicBlock *bb)
{
ASSERT(bb->IsTryBegin());
auto tryInst = GetTryBeginInst(bb);
@ -136,7 +132,7 @@ void CodeGenDynamic::EmitJump(const BasicBlock *bb)
switch (bb->GetLastInst()->GetOpcode()) {
case Opcode::If:
case Opcode::IfImm:
ASSERT(bb->GetSuccsBlocks().size() == compiler::MAX_SUCCS_NUM);
ASSERT(bb->GetSuccsBlocks().size() == ark::compiler::MAX_SUCCS_NUM);
sucBb = bb->GetFalseSuccessor();
break;
default:
@ -150,17 +146,18 @@ void CodeGenDynamic::AddLineNumber([[maybe_unused]] const Inst *inst, [[maybe_un
void CodeGenDynamic::AddColumnNumber([[maybe_unused]] const Inst *inst, [[maybe_unused]] const uint32_t idx) {}
void CodeGenDynamic::EncodeSpillFillData(const compiler::SpillFillData &sf)
void CodeGenDynamic::EncodeSpillFillData(const ark::compiler::SpillFillData &sf)
{
if (sf.SrcType() != compiler::LocationType::REGISTER || sf.DstType() != compiler::LocationType::REGISTER) {
if (sf.SrcType() != ark::compiler::LocationType::REGISTER ||
sf.DstType() != ark::compiler::LocationType::REGISTER) {
std::cerr << "EncodeSpillFillData with unknown move type, src_type: " << static_cast<int>(sf.SrcType())
<< " dst_type: " << static_cast<int>(sf.DstType());
success_ = false;
UNREACHABLE();
return;
}
ASSERT(sf.GetType() != compiler::DataType::NO_TYPE);
ASSERT(sf.SrcValue() != compiler::GetInvalidReg() && sf.DstValue() != compiler::GetInvalidReg());
ASSERT(sf.GetType() != ark::compiler::DataType::NO_TYPE);
ASSERT(sf.SrcValue() != ark::compiler::GetInvalidReg() && sf.DstValue() != ark::compiler::GetInvalidReg());
if (sf.SrcValue() == sf.DstValue()) {
return;
@ -198,17 +195,17 @@ void CodeGenDynamic::VisitConstant(GraphVisitor *visitor, Inst *inst)
InsWrapper movi;
movi.regs.emplace_back(inst->GetDstReg());
switch (type) {
case compiler::DataType::INT64:
case compiler::DataType::UINT64:
case ark::compiler::DataType::INT64:
case ark::compiler::DataType::UINT64:
enc->result_.emplace_back(PandasmWrapper::Create_LDAI_Wrapper(inst->CastToConstant()->GetInt64Value()));
DoSta(inst->GetDstReg(), enc->result_);
break;
case compiler::DataType::FLOAT64:
case ark::compiler::DataType::FLOAT64:
enc->result_.emplace_back(PandasmWrapper::Create_FLDAI_Wrapper(inst->CastToConstant()->GetDoubleValue()));
DoSta(inst->GetDstReg(), enc->result_);
break;
case compiler::DataType::INT32:
case compiler::DataType::UINT32:
case ark::compiler::DataType::INT32:
case ark::compiler::DataType::UINT32:
enc->result_.emplace_back(PandasmWrapper::Create_LDAI_Wrapper(inst->CastToConstant()->GetInt32Value()));
DoSta(inst->GetDstReg(), enc->result_);
break;
@ -219,10 +216,10 @@ void CodeGenDynamic::VisitConstant(GraphVisitor *visitor, Inst *inst)
}
}
void CodeGenDynamic::EncodeSta(compiler::Register reg, compiler::DataType::Type type)
void CodeGenDynamic::EncodeSta(ark::compiler::Register reg, ark::compiler::DataType::Type type)
{
std::string opc;
if (type != compiler::DataType::ANY) {
if (type != ark::compiler::DataType::ANY) {
UNREACHABLE();
std::cerr << "EncodeSta with unknown type" << type;
success_ = false;
@ -252,10 +249,10 @@ void CodeGenDynamic::VisitIf(GraphVisitor *v, Inst *instBase)
DoLda(inst->GetSrcReg(notZeroConstIdx), enc->result_);
auto label = LabelName(inst->GetBasicBlock()->GetTrueSuccessor()->GetId());
switch (inst->GetCc()) {
case compiler::CC_NE:
case ark::compiler::CC_NE:
enc->result_.emplace_back(PandasmWrapper::Create_JNEZ_Wrapper(label));
return;
case compiler::CC_EQ:
case ark::compiler::CC_EQ:
enc->result_.emplace_back(PandasmWrapper::Create_JEQZ_Wrapper(label));
return;
default:
@ -280,10 +277,10 @@ void CodeGenDynamic::IfImmZero(GraphVisitor *v, Inst *instBase)
DoLda(inst->GetSrcReg(0), enc->result_);
auto label = LabelName(inst->GetBasicBlock()->GetTrueSuccessor()->GetId());
switch (inst->GetCc()) {
case compiler::CC_EQ:
case ark::compiler::CC_EQ:
enc->result_.emplace_back(PandasmWrapper::Create_JEQZ_Wrapper(label));
return;
case compiler::CC_NE:
case ark::compiler::CC_NE:
enc->result_.emplace_back(PandasmWrapper::Create_JNEZ_Wrapper(label));
return;
default:
@ -312,7 +309,7 @@ void CodeGenDynamic::VisitReturn(GraphVisitor *v, Inst *instBase)
auto enc = static_cast<CodeGenDynamic *>(v);
auto inst = instBase->CastToReturn();
switch (inst->GetType()) {
case compiler::DataType::ANY: {
case ark::compiler::DataType::ANY: {
#if defined(PANDA_WITH_ECMASCRIPT)
auto test_arg = IsEcmaConstTemplate(inst->GetInput(0).GetInst());
if (test_arg.has_value() && test_arg->IsUndefined()) {
@ -325,7 +322,7 @@ void CodeGenDynamic::VisitReturn(GraphVisitor *v, Inst *instBase)
break;
}
default:
std::cerr << "Codegen for " << compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
std::cerr << "Codegen for " << ark::compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
enc->success_ = false;
}
}
@ -335,7 +332,7 @@ void CodeGenDynamic::VisitIntrinsic(GraphVisitor *visitor, Inst *instBase)
{
ASSERT(instBase->IsIntrinsic());
if (instBase->CastToIntrinsic()->GetIntrinsicId() ==
compiler::RuntimeInterface::IntrinsicId::INTRINSIC_ABCKIT_LOAD_STRING) {
ark::compiler::RuntimeInterface::IntrinsicId::INTRINSIC_ABCKIT_LOAD_STRING) {
VisitLoadStringIntrinsic(visitor, instBase);
return;
}

View File

@ -29,7 +29,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;

View File

@ -19,7 +19,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;

View File

@ -68,4 +68,38 @@ bool IsDynamic(AbckitTarget target)
return target == ABCKIT_TARGET_JS || target == ABCKIT_TARGET_ARK_TS_V1;
}
static size_t HashCombine(size_t seed, size_t value)
{
const auto m = uint64_t {0xC6A4A7935BD1E995};
const uint32_t r = 47;
value *= m;
value ^= value >> r;
value *= m;
seed ^= value;
seed *= m;
return seed;
}
AbckitType *GetOrCreateType(AbckitFile *file, AbckitTypeId id, size_t rank, AbckitCoreClass *klass)
{
size_t hash = 0;
hash = HashCombine(hash, (size_t)id);
hash = HashCombine(hash, rank);
hash = HashCombine(hash, reinterpret_cast<size_t>(klass));
auto &cache = file->types;
if (cache.count(hash) == 1) {
return cache[hash].get();
}
auto type = std::make_unique<AbckitType>();
type->id = id;
type->rank = rank;
type->klass = klass;
cache.insert({hash, std::move(type)});
return cache[hash].get();
}
} // namespace libabckit

View File

@ -31,6 +31,8 @@ void ClassEnumerateMethodsHelper(AbckitCoreClass *klass, void *data,
bool IsDynamic(AbckitTarget target);
AbckitType *GetOrCreateType(AbckitFile *file, AbckitTypeId id, size_t rank, AbckitCoreClass *klass);
} // namespace libabckit
#endif // LIBABCKIT_SRC_HELPERS_COMMON_H

View File

@ -241,19 +241,6 @@ struct AbckitIsaApiStatic {
AbckitInst *(*iCreateIf)(AbckitGraph *graph /* in */, AbckitInst *input0 /* in */, AbckitInst *input1 /* in */,
enum AbckitIsaApiStaticConditionCode cc /* in */);
/**
* @brief iCreateCatchPhi.
* @return AbckitInst *.
* @param [ in ] AbckitGraph *graph .
* @param [ in ] AbckitBasicBlock *catchBegin .
* @param [ in ] size_t argCount .
* @param ... .
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if AbckitGraph *graph is NULL.
* @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if AbckitBasicBlock *catchBegin is NULL.
*/
AbckitInst *(*iCreateCatchPhi)(AbckitGraph *graph /* in */, AbckitBasicBlock *catchBegin /* in */,
size_t argCount /* in */, ... /* catchPhi inputs */);
/**
* @brief iCreateNeg.
* @return AbckitInst *.

View File

@ -25,6 +25,7 @@
#include "libabckit/src/macros.h"
#include "libabckit/src/logger.h"
#include <cstdint>
#include <iostream>
namespace libabckit {
@ -38,7 +39,7 @@ extern "C" AbckitIsaType GgetIsa(AbckitGraph *graph)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(graph, ABCKIT_ISA_TYPE_UNSUPPORTED);
if (IsDynamic(graph->function->m->target)) {
if (IsDynamic(graph->function->owningModule->target)) {
return AbckitIsaType::ABCKIT_ISA_TYPE_DYNAMIC;
}
return AbckitIsaType::ABCKIT_ISA_TYPE_STATIC;
@ -92,6 +93,16 @@ extern "C" AbckitBasicBlock *GgetBasicBlock(AbckitGraph *graph, uint32_t id)
return GgetBasicBlockStatic(graph, id);
}
extern "C" uint32_t GgetNumberOfParameters(AbckitGraph *graph)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(graph, 0);
return GgetNumberOfParametersStatic(graph);
}
extern "C" AbckitInst *GgetParameter(AbckitGraph *graph, uint32_t index)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -275,11 +286,11 @@ extern "C" void BBaddInstBack(AbckitBasicBlock *basicBlock, AbckitInst *inst)
BBaddInstBackStatic(basicBlock, inst);
}
extern "C" void BBclear(AbckitBasicBlock *basicBlock)
extern "C" void BBremoveAllInsts(AbckitBasicBlock *basicBlock)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
return BBclearStatic(basicBlock);
return BBremoveAllInstsStatic(basicBlock);
}
extern "C" AbckitInst *BBgetFirstInst(AbckitBasicBlock *basicBlock)
@ -426,6 +437,22 @@ extern "C" AbckitInst *BBcreatePhi(AbckitBasicBlock *bb, size_t argCount, ...)
return inst;
}
extern "C" AbckitInst *BBcreateCatchPhi(AbckitBasicBlock *catchBegin, size_t argCount, ...)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(catchBegin, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
std::va_list args;
va_start(args, argCount);
auto inst = BBcreateCatchPhiStatic(catchBegin, argCount, args);
va_end(args);
return inst;
}
// ========================================
// Api for instruction manipulation
// ========================================
@ -679,9 +706,9 @@ extern "C" void IsetFunction(AbckitInst *inst, AbckitCoreFunction *function)
LIBABCKIT_BAD_ARGUMENT_VOID(inst);
LIBABCKIT_BAD_ARGUMENT_VOID(function);
LIBABCKIT_BAD_ARGUMENT_VOID(function->m);
LIBABCKIT_BAD_ARGUMENT_VOID(function->owningModule);
LIBABCKIT_BAD_ARGUMENT_VOID(inst->graph);
LIBABCKIT_WRONG_CTX_VOID(inst->graph->file, function->m->file);
LIBABCKIT_WRONG_CTX_VOID(inst->graph->file, function->owningModule->file);
return IsetFunctionStatic(inst, function);
}
@ -803,6 +830,7 @@ AbckitGraphApi g_graphApiImpl = {
GvisitBlocksRPO,
GgetBasicBlock,
GgetParameter,
GgetNumberOfParameters,
GinsertTryCatch,
Gdump,
GcreateConstantI32,
@ -832,7 +860,7 @@ AbckitGraphApi g_graphApiImpl = {
BBsplitBlockAfterInstruction,
BBaddInstFront,
BBaddInstBack,
BBclear,
BBremoveAllInsts,
BBgetFirstInst,
BBgetLastInst,
BBgetNumberOfInstructions,
@ -850,6 +878,7 @@ AbckitGraphApi g_graphApiImpl = {
BBisCatch,
BBdump,
BBcreatePhi,
BBcreateCatchPhi,
// ========================================
// Api for instruction manipulation

View File

@ -179,7 +179,7 @@ void InstBuilder::SetTypeRec(compiler::Inst *inst, compiler::DataType::Type type
}
}
// CC-OFFNXT(WordsTool.190 V8) sensitive word conflict
// CC-OFFNXT(WordsTool.190) sensitive word conflict
/**
* Remove vreg from SaveState for the case
* BB 1

View File

@ -21,7 +21,7 @@
namespace libabckit {
// CC-OFFNXT(WordsTool.95 google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;

View File

@ -226,7 +226,6 @@ AbckitIsaApiDynamic g_isaApiDynamicImpl = {
IcreateDYNAMICReturn,
IcreateDYNAMICReturnundefined,
IcreateDYNAMICIf,
IcreateDYNAMICCatchPhi,
};
} // namespace libabckit

View File

@ -262,7 +262,6 @@ extern "C" AbckitInst *IcreateDYNAMICSetgeneratorstate(AbckitGraph *graph, Abcki
extern "C" AbckitInst *IcreateDYNAMICReturn(AbckitGraph *graph, AbckitInst *acc);
extern "C" AbckitInst *IcreateDYNAMICReturnundefined(AbckitGraph *graph);
extern "C" AbckitInst *IcreateDYNAMICIf(AbckitGraph *graph, AbckitInst *input, AbckitIsaApiDynamicConditionCode cc);
extern "C" AbckitInst *IcreateDYNAMICCatchPhi(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, ...);
extern "C" AbckitIsaApiDynamicConditionCode IgetDYNAMICConditionCode(AbckitInst *inst);
extern "C" void IsetDYNAMICConditionCode(AbckitInst *inst, AbckitIsaApiDynamicConditionCode cc);
extern "C" AbckitCoreImportDescriptor *IgetImportDescriptor(AbckitInst *inst);

View File

@ -435,8 +435,8 @@ extern "C" AbckitInst *IcreateDYNAMICDefinefunc(AbckitGraph *graph, AbckitCoreFu
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::DYNAMIC, nullptr);
return IcreateDynDefinefuncStatic(graph, function, imm0);
}
@ -452,8 +452,8 @@ extern "C" AbckitInst *IcreateDYNAMICDefinemethod(AbckitGraph *graph, AbckitInst
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
LIBABCKIT_WRONG_CTX(graph, acc->graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::DYNAMIC, nullptr);
return IcreateDynDefinemethodStatic(graph, acc, function, imm0);
}
@ -471,8 +471,8 @@ extern "C" AbckitInst *IcreateDYNAMICDefineclasswithbuffer(AbckitGraph *graph, A
LIBABCKIT_BAD_ARGUMENT(input0, nullptr);
LIBABCKIT_WRONG_CTX(graph, input0->graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(function->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::DYNAMIC, nullptr);
return IcreateDynDefineclasswithbufferStatic(graph, function, literalArray, imm0, input0);
}
@ -1336,26 +1336,6 @@ extern "C" AbckitInst *IcreateDYNAMICIf(AbckitGraph *graph, AbckitInst *input, A
return IcreateDynIfStatic(graph, input, cc);
}
extern "C" AbckitInst *IcreateDYNAMICCatchPhi(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, ...)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(catchBegin, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::DYNAMIC, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
va_list args;
va_start(args, argCount);
auto *inst = IcreateCatchPhiStatic(graph, catchBegin, argCount, args);
va_end(args);
return inst;
}
extern "C" AbckitIsaApiDynamicConditionCode IgetDYNAMICConditionCode(AbckitInst *inst)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -1391,7 +1371,7 @@ extern "C" void IsetDYNAMICConditionCode(AbckitInst *inst, AbckitIsaApiDynamicCo
bool ccDynamicResitiction =
!((cc == ABCKIT_ISA_API_DYNAMIC_CONDITION_CODE_CC_NE) || (cc == ABCKIT_ISA_API_DYNAMIC_CONDITION_CODE_CC_EQ));
if (IsDynamic(inst->graph->function->m->target) && ccDynamicResitiction) {
if (IsDynamic(inst->graph->function->owningModule->target) && ccDynamicResitiction) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
LIBABCKIT_LOG(DEBUG) << "Wrong condition code set for dynamic if\n";
return;

View File

@ -1135,7 +1135,7 @@ extern "C" AbckitInst *IcreateDYNAMICCallruntimeDefinesendableclass(AbckitGraph
LIBABCKIT_WRONG_CTX(graph, input0->graph, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->m->file, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, function->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::DYNAMIC, nullptr);
return IcreateDynCallruntimeDefinesendableclassStatic(graph, function, literalArray, imm0, input0);
}

View File

@ -92,25 +92,6 @@ extern "C" AbckitInst *IcreateIf(AbckitGraph *graph, AbckitInst *input0, AbckitI
return IcreateIfStaticStatic(graph, input0, input1, cc);
}
extern "C" AbckitInst *IcreateCatchPhi(AbckitGraph *graph, AbckitBasicBlock *catchBegin, size_t argCount, ...)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(catchBegin, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
va_list args;
va_start(args, argCount);
auto *inst = IcreateCatchPhiStatic(graph, catchBegin, argCount, args);
va_end(args);
return inst;
}
extern "C" AbckitInst *IcreateNeg(AbckitGraph *graph, AbckitInst *input0)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -337,8 +318,8 @@ extern "C" AbckitInst *IcreateNewArray(AbckitGraph *graph, AbckitCoreClass *inpu
LIBABCKIT_BAD_ARGUMENT(inputSize, nullptr);
LIBABCKIT_WRONG_CTX(graph, inputSize->graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputClass->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputClass->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputClass->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputClass->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
statuses::SetLastError(ABCKIT_STATUS_UNSUPPORTED);
@ -352,8 +333,8 @@ extern "C" AbckitInst *IcreateNewObject(AbckitGraph *graph, AbckitCoreClass *inp
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputClass, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputClass->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputClass->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputClass->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputClass->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
return IcreateNewObjectStatic(graph, inputClass);
}
@ -366,8 +347,8 @@ extern "C" AbckitInst *IcreateInitObject(AbckitGraph *graph, AbckitCoreFunction
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
@ -542,8 +523,8 @@ extern "C" AbckitInst *IcreateCallStatic(AbckitGraph *graph, AbckitCoreFunction
LIBABCKIT_BAD_ARGUMENT(graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
@ -565,8 +546,8 @@ extern "C" AbckitInst *IcreateCallVirtual(AbckitGraph *graph, AbckitInst *inputO
LIBABCKIT_BAD_ARGUMENT(inputFunction, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputObj, nullptr);
LIBABCKIT_WRONG_CTX(graph, inputObj->graph, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->m, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->m->file, nullptr);
LIBABCKIT_BAD_ARGUMENT(inputFunction->owningModule, nullptr);
LIBABCKIT_WRONG_CTX(graph->file, inputFunction->owningModule->file, nullptr);
LIBABCKIT_WRONG_MODE(graph, Mode::STATIC, nullptr);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
@ -801,7 +782,7 @@ extern "C" void IsetConditionCode(AbckitInst *inst, AbckitIsaApiStaticConditionC
bool ccDynamicResitiction =
!((cc == ABCKIT_ISA_API_STATIC_CONDITION_CODE_CC_NE) || (cc == ABCKIT_ISA_API_STATIC_CONDITION_CODE_CC_EQ));
if (IsDynamic(inst->graph->function->m->target) && ccDynamicResitiction) {
if (IsDynamic(inst->graph->function->owningModule->target) && ccDynamicResitiction) {
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
LIBABCKIT_LOG(DEBUG) << "Wrong condition code set for dynamic if\n";
return;
@ -861,7 +842,6 @@ AbckitIsaApiStatic g_isaApiStaticImpl = {
IcreateLoadString,
IcreateReturn,
IcreateIf,
IcreateCatchPhi,
IcreateNeg,
IcreateNot,
IcreateAdd,

View File

@ -72,7 +72,7 @@ constexpr uint64_t operator"" _GB(long double count)
return static_cast<uint64_t>(count * (1ULL << SHIFT_GB));
}
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-runtime-int)
constexpr uint64_t operator"" _GB(unsigned long long count)
{

View File

@ -80,7 +80,7 @@ extern "C" AbckitArktsNamespace *CoreNamespaceToArktsNamespace(AbckitCoreNamespa
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(n, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(n->m);
LIBABCKIT_CHECK_ARKTS_TARGET(n->owningModule);
return n->GetArkTSImpl();
}
@ -89,7 +89,7 @@ extern "C" AbckitArktsFunction *ArktsV1NamespaceGetConstructor(AbckitArktsNamesp
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(n, nullptr);
if (n->core->m->target != ABCKIT_TARGET_ARK_TS_V1) {
if (n->core->owningModule->target != ABCKIT_TARGET_ARK_TS_V1) {
libabckit::statuses::SetLastError(ABCKIT_STATUS_WRONG_TARGET);
return nullptr;
}
@ -155,7 +155,7 @@ extern "C" AbckitArktsClass *CoreClassToArktsClass(AbckitCoreClass *c)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(c, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(c->m);
LIBABCKIT_CHECK_ARKTS_TARGET(c->owningModule);
return c->GetArkTSImpl();
}
@ -176,7 +176,7 @@ extern "C" AbckitArktsFunction *CoreFunctionToArktsFunction(AbckitCoreFunction *
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(m, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(m->m);
LIBABCKIT_CHECK_ARKTS_TARGET(m->owningModule);
return m->GetArkTSImpl();
}
@ -186,7 +186,7 @@ extern "C" bool FunctionIsNative(AbckitArktsFunction *function)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, false);
switch (function->core->m->target) {
switch (function->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return FunctionIsNativeDynamic(function->core);
case ABCKIT_TARGET_ARK_TS_V2:
@ -213,7 +213,7 @@ extern "C" AbckitArktsAnnotation *CoreAnnotationToArktsAnnotation(AbckitCoreAnno
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(a, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ai->m);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ai->owningModule);
return a->GetArkTSImpl();
}
@ -234,7 +234,7 @@ extern "C" AbckitArktsAnnotationElement *CoreAnnotationElementToArktsAnnotationE
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(a, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ann->ai->m);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ann->ai->owningModule);
return a->GetArkTSImpl();
}
@ -257,7 +257,7 @@ extern "C" AbckitArktsAnnotationInterface *CoreAnnotationInterfaceToArktsAnnotat
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(a, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(a->m);
LIBABCKIT_CHECK_ARKTS_TARGET(a->owningModule);
return a->GetArkTSImpl();
}
@ -280,7 +280,7 @@ extern "C" AbckitArktsAnnotationInterfaceField *CoreAnnotationInterfaceFieldToAr
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(a, nullptr);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ai->m);
LIBABCKIT_CHECK_ARKTS_TARGET(a->ai->owningModule);
return a->GetArkTSImpl();
}
@ -515,11 +515,17 @@ void ArkTSClassEnumerateAnnotations(AbckitCoreClass *klass, void *data,
// Function
// ========================================
void ArkTSFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreFunction *nestedFunc, void *data))
void ArkTSFunctionEnumerateNestedFunctions([[maybe_unused]] AbckitCoreFunction *function, [[maybe_unused]] void *data,
[[maybe_unused]] bool (*cb)(AbckitCoreFunction *nestedFunc, void *data))
{
for (auto &f : function->nestedFunction) {
if (!cb(f.get(), data)) {
// There is no nested functions in ArkTS
}
void ArkTSFunctionEnumerateNestedClasses(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data))
{
for (auto &c : function->nestedClasses) {
if (!cb(c.get(), data)) {
break;
}
}
@ -550,7 +556,7 @@ void ArkTSAnnotationEnumerateElements(AbckitCoreAnnotation *anno, void *data,
LIBABCKIT_BAD_ARGUMENT_VOID(anno->ai)
AbckitCoreModule *m = anno->ai->m;
AbckitCoreModule *m = anno->ai->owningModule;
LIBABCKIT_BAD_ARGUMENT_VOID(m)
LIBABCKIT_BAD_ARGUMENT_VOID(m->file)

View File

@ -61,6 +61,8 @@ void ArkTSClassEnumerateAnnotations(AbckitCoreClass *klass, void *data,
void ArkTSFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreFunction *nestedFunc, void *data));
void ArkTSFunctionEnumerateNestedClasses(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data));
void ArkTSFunctionEnumerateAnnotations(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreAnnotation *anno, void *data));

View File

@ -29,8 +29,8 @@ namespace libabckit {
// File
// ========================================
extern "C" AbckitArktsModule *FileAddExternalModule(AbckitFile *file,
const struct AbckitArktsExternalModuleCreateParams *params)
extern "C" AbckitArktsModule *FileAddExternalModuleArktsV1(AbckitFile *file,
const struct AbckitArktsV1ExternalModuleCreateParams *params)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
@ -40,7 +40,7 @@ extern "C" AbckitArktsModule *FileAddExternalModule(AbckitFile *file,
switch (file->frontend) {
case Mode::DYNAMIC:
return FileAddExternalModuleDynamic(file, params);
return FileAddExternalArkTsV1Module(file, params);
case Mode::STATIC:
statuses::SetLastError(ABCKIT_STATUS_UNSUPPORTED);
return nullptr;
@ -183,7 +183,7 @@ extern "C" AbckitArktsAnnotation *ClassAddAnnotation(AbckitArktsClass *klass,
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
LIBABCKIT_BAD_ARGUMENT(params, nullptr);
switch (klass->core->m->target) {
switch (klass->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return ClassAddAnnotationDynamic(klass->core, params);
case ABCKIT_TARGET_ARK_TS_V2:
@ -202,7 +202,7 @@ extern "C" void ClassRemoveAnnotation(AbckitArktsClass *klass, AbckitArktsAnnota
LIBABCKIT_BAD_ARGUMENT_VOID(klass);
LIBABCKIT_BAD_ARGUMENT_VOID(anno);
switch (klass->core->m->target) {
switch (klass->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return ClassRemoveAnnotationDynamic(klass->core, anno->core);
case ABCKIT_TARGET_ARK_TS_V2:
@ -226,7 +226,7 @@ extern "C" AbckitArktsAnnotationInterfaceField *AnnotationInterfaceAddField(
LIBABCKIT_BAD_ARGUMENT(ai, nullptr);
LIBABCKIT_BAD_ARGUMENT(params, nullptr);
switch (ai->core->m->target) {
switch (ai->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return AnnotationInterfaceAddFieldDynamic(ai->core, params);
case ABCKIT_TARGET_ARK_TS_V2:
@ -246,7 +246,7 @@ extern "C" void AnnotationInterfaceRemoveField(AbckitArktsAnnotationInterface *a
LIBABCKIT_BAD_ARGUMENT_VOID(ai);
LIBABCKIT_BAD_ARGUMENT_VOID(field);
switch (ai->core->m->target) {
switch (ai->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return AnnotationInterfaceRemoveFieldDynamic(ai->core, field->core);
case ABCKIT_TARGET_ARK_TS_V2:
@ -270,7 +270,7 @@ extern "C" AbckitArktsAnnotation *FunctionAddAnnotation(AbckitArktsFunction *fun
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
LIBABCKIT_BAD_ARGUMENT(params, nullptr);
switch (function->core->m->target) {
switch (function->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return FunctionAddAnnotationDynamic(function->core, params);
case ABCKIT_TARGET_ARK_TS_V2:
@ -289,7 +289,7 @@ extern "C" void FunctionRemoveAnnotation(AbckitArktsFunction *function, AbckitAr
LIBABCKIT_BAD_ARGUMENT_VOID(function);
LIBABCKIT_BAD_ARGUMENT_VOID(anno);
switch (function->core->m->target) {
switch (function->core->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return FunctionRemoveAnnotationDynamic(function->core, anno->core);
case ABCKIT_TARGET_ARK_TS_V2:
@ -315,7 +315,7 @@ extern "C" AbckitArktsAnnotationElement *AnnotationAddAnnotationElement(
LIBABCKIT_BAD_ARGUMENT(anno->core->ai, nullptr);
AbckitCoreModule *module = anno->core->ai->m;
AbckitCoreModule *module = anno->core->ai->owningModule;
LIBABCKIT_BAD_ARGUMENT(module, nullptr);
LIBABCKIT_BAD_ARGUMENT(module->file, nullptr);
@ -341,7 +341,7 @@ extern "C" void AnnotationRemoveAnnotationElement(AbckitArktsAnnotation *anno, A
LIBABCKIT_BAD_ARGUMENT_VOID(anno->core->ai);
AbckitCoreModule *module = anno->core->ai->m;
AbckitCoreModule *module = anno->core->ai->owningModule;
LIBABCKIT_BAD_ARGUMENT_VOID(module);
LIBABCKIT_BAD_ARGUMENT_VOID(module->file);
@ -379,7 +379,7 @@ AbckitArktsModifyApi g_arktsModifyApiImpl = {
// File
// ========================================
FileAddExternalModule,
FileAddExternalModuleArktsV1,
// ========================================
// Module

View File

@ -118,7 +118,7 @@ extern "C" void ModuleEnumerateImports(AbckitCoreModule *m, void *data,
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSModuleEnumerateImports(m, data, cb);
case ABCKIT_TARGET_JS:
return JSModuleEnumerateImports(m, data, cb);
return JsModuleEnumerateImports(m, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -138,7 +138,7 @@ extern "C" void ModuleEnumerateExports(AbckitCoreModule *m, void *data,
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSModuleEnumerateExports(m, data, cb);
case ABCKIT_TARGET_JS:
return JSModuleEnumerateExports(m, data, cb);
return JsModuleEnumerateExports(m, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -175,7 +175,7 @@ extern "C" void ModuleEnumerateClasses(AbckitCoreModule *m, void *data, bool (*c
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSModuleEnumerateClasses(m, data, cb);
case ABCKIT_TARGET_JS:
return JSModuleEnumerateClasses(m, data, cb);
return JsModuleEnumerateClasses(m, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -193,7 +193,7 @@ extern "C" void ModuleEnumerateTopLevelFunctions(AbckitCoreModule *m, void *data
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSModuleEnumerateTopLevelFunctions(m, data, cb);
case ABCKIT_TARGET_JS:
return JSModuleEnumerateTopLevelFunctions(m, data, cb);
return JsModuleEnumerateTopLevelFunctions(m, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -211,7 +211,7 @@ extern "C" void ModuleEnumerateAnonymousFunctions(AbckitCoreModule *m, void *dat
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSModuleEnumerateAnonymousFunctions(m, data, cb);
case ABCKIT_TARGET_JS:
return JSModuleEnumerateAnonymousFunctions(m, data, cb);
return JsModuleEnumerateAnonymousFunctions(m, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -244,7 +244,7 @@ extern "C" AbckitString *NamespaceGetName(AbckitCoreNamespace *n)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(n, nullptr);
switch (n->m->target) {
switch (n->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
return NamespaceGetNameDynamic(n);
case ABCKIT_TARGET_JS:
@ -261,7 +261,7 @@ extern "C" AbckitCoreNamespace *NamespaceGetParentNamespace(AbckitCoreNamespace
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(n, nullptr);
return n->n;
return n->parentNamespace;
}
extern "C" void NamespaceEnumerateNamespaces(AbckitCoreNamespace *n, void *data,
@ -273,7 +273,7 @@ extern "C" void NamespaceEnumerateNamespaces(AbckitCoreNamespace *n, void *data,
LIBABCKIT_BAD_ARGUMENT_VOID(n)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(n->m)) {
switch (ModuleGetTarget(n->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSNamespaceEnumerateNamespaces(n, data, cb);
@ -293,7 +293,7 @@ extern "C" void NamespaceEnumerateClasses(AbckitCoreNamespace *n, void *data,
LIBABCKIT_BAD_ARGUMENT_VOID(n)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(n->m)) {
switch (ModuleGetTarget(n->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSNamespaceEnumerateClasses(n, data, cb);
@ -313,7 +313,7 @@ extern "C" void NamespaceEnumerateTopLevelFunctions(AbckitCoreNamespace *n, void
LIBABCKIT_BAD_ARGUMENT_VOID(n)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(n->m)) {
switch (ModuleGetTarget(n->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSNamespaceEnumerateTopLevelFunctions(n, data, cb);
@ -437,7 +437,7 @@ extern "C" AbckitFile *ClassGetFile(AbckitCoreClass *klass)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
return klass->m->file;
return klass->owningModule->file;
}
extern "C" AbckitCoreModule *ClassGetModule(AbckitCoreClass *klass)
@ -447,7 +447,7 @@ extern "C" AbckitCoreModule *ClassGetModule(AbckitCoreClass *klass)
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
return klass->m;
return klass->owningModule;
}
extern "C" AbckitString *ClassGetName(AbckitCoreClass *klass)
@ -456,18 +456,26 @@ extern "C" AbckitString *ClassGetName(AbckitCoreClass *klass)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(klass, nullptr)
if (IsDynamic(klass->m->target)) {
if (IsDynamic(klass->owningModule->target)) {
return ClassGetNameDynamic(klass);
}
return ClassGetNameStatic(klass);
}
extern "C" AbckitCoreFunction *ClassGetParentFunction(AbckitCoreClass *klass)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
return klass->parentFunction;
}
extern "C" AbckitCoreNamespace *ClassGetParentNamespace(AbckitCoreClass *klass)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
return klass->n;
return klass->parentNamespace;
}
extern "C" void ClassEnumerateMethods(AbckitCoreClass *klass, void *data,
@ -479,12 +487,12 @@ extern "C" void ClassEnumerateMethods(AbckitCoreClass *klass, void *data,
LIBABCKIT_BAD_ARGUMENT_VOID(klass)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (klass->m->target) {
switch (klass->owningModule->target) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSClassEnumerateMethods(klass, data, cb);
case ABCKIT_TARGET_JS:
return JSClassEnumerateMethods(klass, data, cb);
return JsClassEnumerateMethods(klass, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -499,7 +507,7 @@ extern "C" void ClassEnumerateAnnotations(AbckitCoreClass *klass, void *data,
LIBABCKIT_BAD_ARGUMENT_VOID(klass)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(klass->m)) {
switch (ModuleGetTarget(klass->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSClassEnumerateAnnotations(klass, data, cb);
@ -520,7 +528,7 @@ extern "C" AbckitFile *AnnotationInterfaceGetFile(AbckitCoreAnnotationInterface
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(anno, nullptr);
return anno->m->file;
return anno->owningModule->file;
}
extern "C" AbckitCoreModule *AnnotationInterfaceGetModule(AbckitCoreAnnotationInterface *anno)
@ -529,7 +537,7 @@ extern "C" AbckitCoreModule *AnnotationInterfaceGetModule(AbckitCoreAnnotationIn
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(anno, nullptr);
return anno->m;
return anno->owningModule;
}
extern "C" AbckitString *AnnotationInterfaceGetName(AbckitCoreAnnotationInterface *ai)
@ -539,7 +547,7 @@ extern "C" AbckitString *AnnotationInterfaceGetName(AbckitCoreAnnotationInterfac
LIBABCKIT_BAD_ARGUMENT(ai, nullptr);
if (IsDynamic(ai->m->target)) {
if (IsDynamic(ai->owningModule->target)) {
return AnnotationInterfaceGetNameDynamic(ai);
}
statuses::SetLastError(ABCKIT_STATUS_UNSUPPORTED);
@ -555,7 +563,7 @@ extern "C" void AnnotationInterfaceEnumerateFields(AbckitCoreAnnotationInterface
LIBABCKIT_BAD_ARGUMENT_VOID(ai)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(ai->m)) {
switch (ModuleGetTarget(ai->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSAnnotationInterfaceEnumerateFields(ai, data, cb);
@ -577,7 +585,7 @@ extern "C" AbckitFile *AnnotationInterfaceFieldGetFile(AbckitCoreAnnotationInter
LIBABCKIT_BAD_ARGUMENT(fld, nullptr);
return fld->ai->m->file;
return fld->ai->owningModule->file;
}
extern "C" AbckitCoreAnnotationInterface *AnnotationInterfaceFieldGetInterface(AbckitCoreAnnotationInterfaceField *fld)
@ -629,7 +637,7 @@ extern "C" AbckitFile *FunctionGetFile(AbckitCoreFunction *function)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
return function->m->file;
return function->owningModule->file;
}
extern "C" AbckitCoreModule *FunctionGetModule(AbckitCoreFunction *function)
@ -639,7 +647,7 @@ extern "C" AbckitCoreModule *FunctionGetModule(AbckitCoreFunction *function)
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
return function->m;
return function->owningModule;
}
extern "C" AbckitString *FunctionGetName(AbckitCoreFunction *function)
@ -649,12 +657,22 @@ extern "C" AbckitString *FunctionGetName(AbckitCoreFunction *function)
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
return FunctionGetNameDynamic(function);
}
return FunctionGetNameStatic(function);
}
extern "C" AbckitCoreFunction *FunctionGetParentFunction(AbckitCoreFunction *function)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
return function->parentFunction;
}
extern "C" AbckitCoreClass *FunctionGetParentClass(AbckitCoreFunction *function)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -662,7 +680,7 @@ extern "C" AbckitCoreClass *FunctionGetParentClass(AbckitCoreFunction *function)
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
return function->klass;
return function->parentClass;
}
extern "C" AbckitCoreNamespace *FunctionGetParentNamespace(AbckitCoreFunction *function)
@ -670,7 +688,7 @@ extern "C" AbckitCoreNamespace *FunctionGetParentNamespace(AbckitCoreFunction *f
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
return function->n;
return function->parentNamespace;
}
extern "C" void FunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
@ -682,12 +700,32 @@ extern "C" void FunctionEnumerateNestedFunctions(AbckitCoreFunction *function, v
LIBABCKIT_BAD_ARGUMENT_VOID(function)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(function->m)) {
switch (ModuleGetTarget(function->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSFunctionEnumerateNestedFunctions(function, data, cb);
case ABCKIT_TARGET_JS:
return JSFunctionEnumerateNestedFunctions(function, data, cb);
return JsFunctionEnumerateNestedFunctions(function, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
}
extern "C" void FunctionEnumerateNestedClasses(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data))
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT_VOID(function)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(function->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSFunctionEnumerateNestedClasses(function, data, cb);
case ABCKIT_TARGET_JS:
return JsFunctionEnumerateNestedClasses(function, data, cb);
default:
LIBABCKIT_UNREACHABLE;
}
@ -702,7 +740,7 @@ extern "C" void FunctionEnumerateAnnotations(AbckitCoreFunction *function, void
LIBABCKIT_BAD_ARGUMENT_VOID(function)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
switch (ModuleGetTarget(function->m)) {
switch (ModuleGetTarget(function->owningModule)) {
case ABCKIT_TARGET_ARK_TS_V1:
case ABCKIT_TARGET_ARK_TS_V2:
return ArkTSFunctionEnumerateAnnotations(function, data, cb);
@ -719,7 +757,7 @@ extern "C" AbckitGraph *CreateGraphFromFunction(AbckitCoreFunction *function)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, nullptr);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
return CreateGraphFromFunctionDynamic(function);
}
return CreateGraphFromFunctionStatic(function);
@ -731,7 +769,7 @@ extern "C" bool FunctionIsStatic(AbckitCoreFunction *function)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, false);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
return FunctionIsStaticDynamic(function);
}
return FunctionIsStaticStatic(function);
@ -743,7 +781,7 @@ extern "C" bool FunctionIsCtor(AbckitCoreFunction *function)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, false);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
return FunctionIsCtorDynamic(function);
}
return FunctionIsCtorStatic(function);
@ -755,7 +793,7 @@ extern "C" bool FunctionIsAnonymous(AbckitCoreFunction *function)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(function, false);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
return FunctionIsAnonymousDynamic(function);
}
return FunctionIsAnonymousStatic(function);
@ -772,7 +810,7 @@ extern "C" AbckitFile *AnnotationGetFile(AbckitCoreAnnotation *anno)
LIBABCKIT_BAD_ARGUMENT(anno, nullptr);
return anno->ai->m->file;
return anno->ai->owningModule->file;
}
extern "C" AbckitCoreAnnotationInterface *AnnotationGetInterface(AbckitCoreAnnotation *anno)
@ -794,7 +832,7 @@ extern "C" void AnnotationEnumerateElements(AbckitCoreAnnotation *anno, void *da
LIBABCKIT_BAD_ARGUMENT_VOID(anno)
LIBABCKIT_BAD_ARGUMENT_VOID(cb)
AbckitCoreModule *m = anno->ai->m;
AbckitCoreModule *m = anno->ai->owningModule;
switch (ModuleGetTarget(m)) {
case ABCKIT_TARGET_ARK_TS_V1:
@ -818,7 +856,7 @@ extern "C" AbckitFile *AnnotationElementGetFile(AbckitCoreAnnotationElement *ae)
LIBABCKIT_BAD_ARGUMENT(ae, nullptr);
return ae->ann->ai->m->file;
return ae->ann->ai->owningModule->file;
}
extern "C" AbckitCoreAnnotation *AnnotationElementGetAnnotation(AbckitCoreAnnotationElement *ae)
@ -1343,6 +1381,7 @@ AbckitInspectApi g_inspectApiImpl = {
ClassGetFile,
ClassGetModule,
ClassGetName,
ClassGetParentFunction,
ClassGetParentNamespace,
ClassEnumerateMethods,
ClassEnumerateAnnotations,
@ -1354,9 +1393,11 @@ AbckitInspectApi g_inspectApiImpl = {
FunctionGetFile,
FunctionGetModule,
FunctionGetName,
FunctionGetParentFunction,
FunctionGetParentClass,
FunctionGetParentNamespace,
FunctionEnumerateNestedFunctions,
FunctionEnumerateNestedClasses,
FunctionEnumerateAnnotations,
CreateGraphFromFunction,
FunctionIsStatic,

View File

@ -123,7 +123,7 @@ struct AbckitCoreAnnotationInterface {
/*
* To refer to the properties of the origin module.
*/
AbckitCoreModule *m = nullptr;
AbckitCoreModule *owningModule = nullptr;
/*
* Contains annotation interface fields
@ -274,12 +274,17 @@ struct AbckitCoreClass {
/*
* To refer to the properties of the origin module.
*/
AbckitCoreModule *m = nullptr;
AbckitCoreModule *owningModule = nullptr;
/*
* To refer to the properties of the parent namepsace.
*/
AbckitCoreNamespace *n = nullptr;
AbckitCoreNamespace *parentNamespace = nullptr;
/*
* To refer to the properties of the parent function.
*/
AbckitCoreFunction *parentFunction = nullptr;
/*
* To store class methods.
@ -299,7 +304,7 @@ struct AbckitCoreClass {
{
return std::get<std::unique_ptr<AbckitArktsClass>>(impl).get();
}
AbckitJsClass *GetJSImpl()
AbckitJsClass *GetJsImpl()
{
return std::get<std::unique_ptr<AbckitJsClass>>(impl).get();
}
@ -308,13 +313,13 @@ struct AbckitCoreClass {
{
klass.core = this;
impl = std::make_unique<AbckitJsClass>(klass);
m = module;
owningModule = module;
}
AbckitCoreClass(AbckitCoreModule *module, AbckitArktsClass klass)
{
klass.core = this;
impl = std::make_unique<AbckitArktsClass>(klass);
m = module;
owningModule = module;
}
};
@ -342,12 +347,12 @@ struct AbckitCoreFunction {
/*
* To refer to the properties of the origin module.
*/
AbckitCoreModule *m = nullptr;
AbckitCoreModule *owningModule = nullptr;
/*
* To refer to the properties of the parent namepsace.
*/
AbckitCoreNamespace *n = nullptr;
AbckitCoreNamespace *parentNamespace = nullptr;
/*
* To be able to refer to the class where method is defined.
@ -355,7 +360,12 @@ struct AbckitCoreFunction {
* - Dynamic: pandasm::Function with js file name.
* - Static: pandasm::Record with name `L/.../ETSGLOBAL`.
*/
AbckitCoreClass *klass = nullptr;
AbckitCoreClass *parentClass = nullptr;
/*
* To be able to refer to the class where method is defined.
*/
AbckitCoreFunction *parentFunction = nullptr;
/*
* To store links to the wrapped annotations.
@ -363,6 +373,9 @@ struct AbckitCoreFunction {
std::vector<std::unique_ptr<AbckitCoreAnnotation>> annotations;
std::vector<std::unique_ptr<AbckitCoreFunction>> nestedFunction;
std::vector<std::unique_ptr<AbckitCoreClass>> nestedClasses;
bool isAnonymous = false;
std::variant<std::unique_ptr<AbckitJsFunction>, std::unique_ptr<AbckitArktsFunction>> impl;
@ -370,7 +383,7 @@ struct AbckitCoreFunction {
{
return std::get<std::unique_ptr<AbckitArktsFunction>>(impl).get();
}
AbckitJsFunction *GetJSImpl()
AbckitJsFunction *GetJsImpl()
{
return std::get<std::unique_ptr<AbckitJsFunction>>(impl).get();
}
@ -385,11 +398,17 @@ struct AbckitArktsNamespace {
};
struct AbckitCoreNamespace {
explicit AbckitCoreNamespace(AbckitCoreModule *m) : m(m) {}
explicit AbckitCoreNamespace(AbckitCoreModule *owningModule) : owningModule(owningModule) {}
AbckitCoreModule *m = nullptr;
/*
* To refer to the properties of the origin module.
*/
AbckitCoreModule *owningModule = nullptr;
AbckitCoreNamespace *n = nullptr;
/*
* To be able to refer to the namespace where method is defined.
*/
AbckitCoreNamespace *parentNamespace = nullptr;
/*
* To store links to the wrapped methods.
@ -514,7 +533,7 @@ struct AbckitCoreModule {
{
return std::get<std::unique_ptr<AbckitArktsModule>>(impl).get();
}
AbckitJsModule *GetJSImpl()
AbckitJsModule *GetJsImpl()
{
return std::get<std::unique_ptr<AbckitJsModule>>(impl).get();
}
@ -612,9 +631,8 @@ struct AbckitFile {
}
AbcKitLiterals literals;
// NOTE: these vectors grows infinitely (even for same values)
std::unordered_map<size_t, std::unique_ptr<AbckitType>> types;
std::vector<std::unique_ptr<AbckitValue>> values;
std::vector<std::unique_ptr<AbckitType>> types;
std::vector<std::unique_ptr<AbckitLiteralArray>> litarrs;
/*
@ -736,7 +754,7 @@ struct AbckitCoreImportDescriptor {
{
return std::get<std::unique_ptr<AbckitArktsImportDescriptor>>(impl).get();
}
AbckitJsImportDescriptor *GetJSImpl()
AbckitJsImportDescriptor *GetJsImpl()
{
return std::get<std::unique_ptr<AbckitJsImportDescriptor>>(impl).get();
}
@ -857,7 +875,7 @@ struct AbckitCoreExportDescriptor {
{
return std::get<std::unique_ptr<AbckitArktsExportDescriptor>>(impl).get();
}
AbckitJsExportDescriptor *GetJSImpl()
AbckitJsExportDescriptor *GetJsImpl()
{
return std::get<std::unique_ptr<AbckitJsExportDescriptor>>(impl).get();
}

View File

@ -58,7 +58,7 @@ extern "C" AbckitJsModule *CoreModuleToJsModule(AbckitCoreModule *m)
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(m, nullptr);
LIBABCKIT_CHECK_JS_TARGET(m);
return m->GetJSImpl();
return m->GetJsImpl();
}
// ========================================
@ -79,7 +79,7 @@ extern "C" AbckitJsImportDescriptor *CoreImportDescriptorToJsImportDescriptor(Ab
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(id, nullptr);
LIBABCKIT_CHECK_JS_TARGET(id->importingModule);
return id->GetJSImpl();
return id->GetJsImpl();
}
// ========================================
@ -100,7 +100,7 @@ extern "C" AbckitJsExportDescriptor *CoreExportDescriptorToJsExportDescriptor(Ab
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(ed, nullptr);
LIBABCKIT_CHECK_JS_TARGET(ed->exportingModule);
return ed->GetJSImpl();
return ed->GetJsImpl();
}
// ========================================
@ -120,8 +120,8 @@ extern "C" AbckitJsClass *CoreClassToJsClass(AbckitCoreClass *c)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(c, nullptr);
LIBABCKIT_CHECK_JS_TARGET(c->m);
return c->GetJSImpl();
LIBABCKIT_CHECK_JS_TARGET(c->owningModule);
return c->GetJsImpl();
}
// ========================================
@ -149,8 +149,8 @@ extern "C" AbckitJsFunction *CoreFunctionToJsFunction(AbckitCoreFunction *m)
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT(m, nullptr);
LIBABCKIT_CHECK_JS_TARGET(m->m);
return m->GetJSImpl();
LIBABCKIT_CHECK_JS_TARGET(m->owningModule);
return m->GetJsImpl();
}
// ========================================
@ -257,7 +257,7 @@ AbckitJsInspectApi g_jsInspectApiImpl = {
// Module
// ========================================
void JSModuleEnumerateImports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreImportDescriptor *i, void *data))
void JsModuleEnumerateImports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreImportDescriptor *i, void *data))
{
for (auto &id : m->id) {
if (!cb(id.get(), data)) {
@ -266,7 +266,7 @@ void JSModuleEnumerateImports(AbckitCoreModule *m, void *data, bool (*cb)(Abckit
}
}
void JSModuleEnumerateExports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreExportDescriptor *e, void *data))
void JsModuleEnumerateExports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreExportDescriptor *e, void *data))
{
for (auto &ed : m->ed) {
if (!cb(ed.get(), data)) {
@ -275,24 +275,24 @@ void JSModuleEnumerateExports(AbckitCoreModule *m, void *data, bool (*cb)(Abckit
}
}
void JSModuleEnumerateClasses(AbckitCoreModule *m, void *data, bool cb(AbckitCoreClass *klass, void *data))
void JsModuleEnumerateClasses(AbckitCoreModule *m, void *data, bool cb(AbckitCoreClass *klass, void *data))
{
ModuleEnumerateClassesHelper(m, data, cb);
}
void JSModuleEnumerateTopLevelFunctions(AbckitCoreModule *m, void *data,
void JsModuleEnumerateTopLevelFunctions(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreFunction *function, void *data))
{
ModuleEnumerateTopLevelFunctionsHelper(m, data, cb);
}
void JSModuleEnumerateAnonymousFunctions(AbckitCoreModule *m, void *data,
void JsModuleEnumerateAnonymousFunctions(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreFunction *function, void *data))
{
ModuleEnumerateAnonymousFunctionsDynamic(m, data, cb);
}
void JSModuleEnumerateAnnotationInterfaces(AbckitCoreModule *m, void *data,
void JsModuleEnumerateAnnotationInterfaces(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreAnnotationInterface *ai, void *data))
{
ModuleEnumerateAnnotationInterfacesHelper(m, data, cb);
@ -302,7 +302,7 @@ void JSModuleEnumerateAnnotationInterfaces(AbckitCoreModule *m, void *data,
// Class
// ========================================
void JSClassEnumerateMethods(AbckitCoreClass *klass, void *data, bool (*cb)(AbckitCoreFunction *function, void *data))
void JsClassEnumerateMethods(AbckitCoreClass *klass, void *data, bool (*cb)(AbckitCoreFunction *function, void *data))
{
ClassEnumerateMethodsHelper(klass, data, cb);
}
@ -311,7 +311,7 @@ void JSClassEnumerateMethods(AbckitCoreClass *klass, void *data, bool (*cb)(Abck
// Function
// ========================================
void JSFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
void JsFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreFunction *nestedFunc, void *data))
{
for (auto &f : function->nestedFunction) {
@ -321,6 +321,16 @@ void JSFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data
}
}
void JsFunctionEnumerateNestedClasses(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data))
{
for (auto &c : function->nestedClasses) {
if (!cb(c.get(), data)) {
break;
}
}
}
} // namespace libabckit
extern "C" AbckitJsInspectApi const *AbckitGetJsInspectApiImpl(AbckitApiVersion version)

View File

@ -24,28 +24,30 @@ namespace libabckit {
// Module
// ========================================
void JSModuleEnumerateImports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreImportDescriptor *i, void *data));
void JSModuleEnumerateExports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreExportDescriptor *e, void *data));
void JSModuleEnumerateClasses(AbckitCoreModule *m, void *data, bool cb(AbckitCoreClass *klass, void *data));
void JSModuleEnumerateTopLevelFunctions(AbckitCoreModule *m, void *data,
void JsModuleEnumerateImports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreImportDescriptor *i, void *data));
void JsModuleEnumerateExports(AbckitCoreModule *m, void *data, bool (*cb)(AbckitCoreExportDescriptor *e, void *data));
void JsModuleEnumerateClasses(AbckitCoreModule *m, void *data, bool cb(AbckitCoreClass *klass, void *data));
void JsModuleEnumerateTopLevelFunctions(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreFunction *function, void *data));
void JSModuleEnumerateAnonymousFunctions(AbckitCoreModule *m, void *data,
void JsModuleEnumerateAnonymousFunctions(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreFunction *function, void *data));
void JSModuleEnumerateAnnotationInterfaces(AbckitCoreModule *m, void *data,
void JsModuleEnumerateAnnotationInterfaces(AbckitCoreModule *m, void *data,
bool (*cb)(AbckitCoreAnnotationInterface *ai, void *data));
// ========================================
// Class
// ========================================
void JSClassEnumerateMethods(AbckitCoreClass *klass, void *data, bool (*cb)(AbckitCoreFunction *method, void *data));
void JsClassEnumerateMethods(AbckitCoreClass *klass, void *data, bool (*cb)(AbckitCoreFunction *method, void *data));
// ========================================
// Function
// ========================================
void JSFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
void JsFunctionEnumerateNestedFunctions(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreFunction *nestedFunc, void *data));
void JsFunctionEnumerateNestedClasses(AbckitCoreFunction *function, void *data,
bool (*cb)(AbckitCoreClass *nestedClass, void *data));
} // namespace libabckit

View File

@ -28,7 +28,7 @@ namespace libabckit {
// File
// ========================================
extern "C" AbckitJsModule *FileAddExternalModuleDYNAMIC(AbckitFile *file,
extern "C" AbckitJsModule *FileAddExternalModule(AbckitFile *file,
const struct AbckitJsExternalModuleCreateParams *params)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -42,14 +42,14 @@ extern "C" AbckitJsModule *FileAddExternalModuleDYNAMIC(AbckitFile *file,
return nullptr;
}
return FileAddExternalModuleDynamic(file, params);
return FileAddExternalJsModule(file, params);
}
// ========================================
// Module
// ========================================
extern "C" AbckitJsImportDescriptor *ModuleAddImportFromJSToJS(
extern "C" AbckitJsImportDescriptor *ModuleAddImportFromJsToJs(
AbckitJsModule *importing /* assert(importing.target === AbckitTarget_ArkTS_v2) */,
AbckitJsModule *imported /* assert(importing.target === AbckitTarget_ArkTS_v2) */,
const struct AbckitJsImportFromDynamicModuleCreateParams *params)
@ -64,7 +64,7 @@ extern "C" AbckitJsImportDescriptor *ModuleAddImportFromJSToJS(
return ModuleAddImportFromDynamicModuleDynamic(importing->core, imported->core, params);
}
extern "C" void ModuleRemoveImportDYNAMIC(AbckitJsModule *m, AbckitJsImportDescriptor *i)
extern "C" void ModuleRemoveImportJs(AbckitJsModule *m, AbckitJsImportDescriptor *i)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
@ -75,7 +75,7 @@ extern "C" void ModuleRemoveImportDYNAMIC(AbckitJsModule *m, AbckitJsImportDescr
return ModuleRemoveImportDynamic(m->core, i);
}
extern "C" AbckitJsExportDescriptor *ModuleAddExportFromJSToJS(AbckitJsModule *exporting, AbckitJsModule *exported,
extern "C" AbckitJsExportDescriptor *ModuleAddExportFromJsToJs(AbckitJsModule *exporting, AbckitJsModule *exported,
const AbckitJsDynamicModuleExportCreateParams *params)
{
LIBABCKIT_CLEAR_LAST_ERROR;
@ -87,7 +87,7 @@ extern "C" AbckitJsExportDescriptor *ModuleAddExportFromJSToJS(AbckitJsModule *e
return DynamicModuleAddExportDynamic(exporting->core, exported != nullptr ? exported->core : nullptr, params);
}
extern "C" void ModuleRemoveExportDYNAMIC(AbckitJsModule *m, AbckitJsExportDescriptor *i)
extern "C" void ModuleRemoveExportJs(AbckitJsModule *m, AbckitJsExportDescriptor *i)
{
LIBABCKIT_CLEAR_LAST_ERROR;
LIBABCKIT_IMPLEMENTED;
@ -136,13 +136,13 @@ AbckitJsModifyApi g_jsModifyApiImpl = {
// File
// ========================================
FileAddExternalModuleDYNAMIC,
FileAddExternalModule,
// ========================================
// Module
// ========================================
ModuleAddImportFromJSToJS, ModuleRemoveImportDYNAMIC, ModuleAddExportFromJSToJS, ModuleRemoveExportDYNAMIC,
ModuleAddImportFromJsToJs, ModuleRemoveImportJs, ModuleAddExportFromJsToJs, ModuleRemoveExportJs,
// ========================================
// Class

View File

@ -52,15 +52,14 @@ namespace libabckit {
extern "C" void FunctionSetGraph(AbckitCoreFunction *function, AbckitGraph *graph)
{
LIBABCKIT_CLEAR_LAST_ERROR;
;
LIBABCKIT_IMPLEMENTED;
LIBABCKIT_BAD_ARGUMENT_VOID(function)
LIBABCKIT_BAD_ARGUMENT_VOID(graph)
LIBABCKIT_WRONG_CTX_VOID(function->m->file, graph->file);
LIBABCKIT_WRONG_CTX_VOID(function->owningModule->file, graph->file);
if (IsDynamic(function->m->target)) {
if (IsDynamic(function->owningModule->target)) {
FunctionSetGraphDynamic(function, graph);
} else {
FunctionSetGraphStatic(function, graph);
@ -85,13 +84,7 @@ extern "C" AbckitType *CreateType(AbckitFile *file, AbckitTypeId id)
statuses::SetLastError(ABCKIT_STATUS_BAD_ARGUMENT);
return nullptr;
}
auto type = std::make_unique<AbckitType>();
type->rank = 0;
type->id = id;
type->klass = nullptr;
file->types.emplace_back(std::move(type));
auto res = file->types.back().get();
return res;
return GetOrCreateType(file, id, 0, nullptr);
}
extern "C" AbckitType *CreateReferenceType(AbckitFile *file, AbckitCoreClass *klass)
@ -101,13 +94,7 @@ extern "C" AbckitType *CreateReferenceType(AbckitFile *file, AbckitCoreClass *kl
LIBABCKIT_BAD_ARGUMENT(file, nullptr);
LIBABCKIT_BAD_ARGUMENT(klass, nullptr);
auto type = std::make_unique<AbckitType>();
type->id = AbckitTypeId::ABCKIT_TYPE_ID_REFERENCE;
type->rank = 0;
type->klass = klass;
file->types.emplace_back(std::move(type));
auto res = file->types.back().get();
return res;
return GetOrCreateType(file, AbckitTypeId::ABCKIT_TYPE_ID_REFERENCE, 0, klass);
}
// ========================================

View File

@ -29,7 +29,7 @@
#include "libpandafile/type_helper.h"
namespace libabckit {
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;

View File

@ -41,7 +41,7 @@
#include <iostream>
namespace libabckit {
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace ark;

View File

@ -24,7 +24,7 @@
#include <generated/opc_to_string.h>
namespace libabckit {
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace panda;

View File

@ -29,6 +29,7 @@ template("create_merge_file") {
script = "./../scripts/create_merge_file.sh"
args = [
rebase_path(target_gen_dir),
rebase_path(invoker.input_file),
rebase_path(invoker.output_file),
]
@ -182,7 +183,12 @@ test_js_files = [
"scenarios/branch_eliminator/dynamic/branch_eliminator",
"scenarios/scan_subclasses/dynamic/scan_subclasses",
"scenarios/parameter_check/dynamic/parameter_check",
"scenarios_c_api_clean/add_log_js/add_log_dynamic",
"scenarios_c_api_clean/dynamic/add_log/add_log_dynamic",
"scenarios_c_api_clean/dynamic/scan_subclasses/scan_subclasses",
"scenarios_c_api_clean/dynamic/parameter_check/parameter_check",
"scenarios_c_api_clean/dynamic/api_scanner/api_scanner",
"scenarios_c_api_clean/dynamic/branch_eliminator/branch_eliminator",
"scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch",
"internal/ICSlotAllocator/ICSlotAllocator",
"internal/implementation_api/abc_dynamic",
@ -198,7 +204,7 @@ test_ts_files = [
"scenarios/router_table/dynamic/router_table",
"scenarios/replace_call_site/dynamic/replace_call_site",
"ut/isa/isa_dynamic/catchphi/catchphi_dynamic",
"ut/ir_core/catchphi/catchphi_dynamic",
"ut/ir_core/phi/phi_dynamic",
@ -211,6 +217,9 @@ test_ts_files = [
"ut/extensions/arkts/inspect_api/api_casts/api_casts",
"ut/extensions/arkts/inspect_api/namespace/namespace_arkts_dynamic",
"ut/extensions/arkts/modify_api/annotations/annotations_dynamic",
"scenarios_c_api_clean/dynamic/replace_call_site/replace_call_site",
"scenarios_c_api_clean/dynamic/router_table/router_table",
]
test_ets_files = [
@ -247,7 +256,7 @@ test_ets_files = [
"ut/isa/isa_static/cast/target_type_static",
"ut/isa/isa_static/call/call_static_static",
"ut/isa/isa_static/call/call_virtual_static",
"ut/isa/isa_static/catchphi/catchphi_static",
"ut/ir_core/catchphi/catchphi_static",
"ut/isa/isa_static/cmp/create_cmp_static",
"ut/isa/isa_static/load_string/load_string_static",
"ut/isa/isa_static/load_undefined/load_undefined_static",
@ -276,6 +285,7 @@ test_ets_files = [
"ut/ir_core/loops/loop_static",
"ut/ir_core/insert_try_catch/insert_try_catch_static",
"ut/ir_core/graph_verifier/graph_verifier",
"ut/extensions/arkts/modify_api/modules/modules_static_modify",
"internal/implementation_api/abc_static",
"internal/mem_manager/abc_static_1",
@ -288,8 +298,7 @@ test_ets_files = [
"scenarios/replace_callsite/replace_callsite_static",
"scenarios/api_scanner/static/api_scanner_static",
"scenarios/static_branch_elimination/static_branch_elimination",
"scenarios_c_api_clean/add_log_arkts2/add_log_static",
"ut/extensions/arkts/modify_api/modules/modules_static_modify",
"scenarios_c_api_clean/static/add_log/add_log_static",
]
module_output_path = "arkcompiler/runtime_core/libabckit"
@ -453,15 +462,22 @@ libabckit_host_unittest_action("abckit_gtests") {
"scenarios/scan_subclasses/dynamic/scan_subclasses_test.cpp",
"scenarios/scan_subclasses/dynamic/subclasses_scanner.cpp",
"scenarios/static_branch_elimination/static_branch_elimination.cpp",
"scenarios_c_api_clean/add_log_arkts2/add_log_static_test.cpp",
"scenarios_c_api_clean/add_log_js/add_log_dynamic_test.cpp",
"scenarios_c_api_clean/dynamic/add_log/add_log_dynamic_test.cpp",
"scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch_test.cpp",
"scenarios_c_api_clean/dynamic/api_scanner/api_scanner_test.cpp",
"scenarios_c_api_clean/dynamic/branch_eliminator/branch_eliminator_test.cpp",
"scenarios_c_api_clean/dynamic/parameter_check/parameter_check_test.cpp",
"scenarios_c_api_clean/dynamic/replace_call_site/replace_call_site_test.cpp",
"scenarios_c_api_clean/dynamic/router_table/router_table_test.cpp",
"scenarios_c_api_clean/dynamic/scan_subclasses/scan_subclasses_test.cpp",
"scenarios_c_api_clean/static/add_log/add_log_static_test.cpp",
"ut/extensions/arkts/inspect_api/api_casts/api_casts.cpp",
"ut/extensions/arkts/inspect_api/modules/modules_dynamic_test.cpp",
"ut/extensions/arkts/inspect_api/namespace/namespace_arkts.cpp",
"ut/extensions/arkts/modify_api/annotations/annotations_test.cpp",
"ut/extensions/arkts/modify_api/modules/modules_dynamic_modify_test.cpp",
"ut/extensions/js/inspect_api/api_casts/api_casts.cpp",
"ut/extensions/js/inspect_api/enumerators/modules_test.cpp",
"ut/extensions/js/inspect_api/enumerators/enumerators_test.cpp",
"ut/extensions/js/inspect_api/modules/modules_dynamic_test.cpp",
"ut/extensions/js/modify_api/arrays/array_modify_test.cpp",
"ut/extensions/js/modify_api/bigint/load_bigint_test.cpp",
@ -472,6 +488,8 @@ libabckit_host_unittest_action("abckit_gtests") {
"ut/extensions/js/modify_api/super_this/super_this_modify.cpp",
"ut/ir_core/basic_blocks/basic_blocks_dynamic.cpp",
"ut/ir_core/basic_blocks/basic_blocks_static.cpp",
"ut/ir_core/catchphi/catchphi_dynamic.cpp",
"ut/ir_core/catchphi/catchphi_static.cpp",
"ut/ir_core/create_constant/create_constant_dynamic.cpp",
"ut/ir_core/create_constant/create_constant_static.cpp",
"ut/ir_core/get_constant_value/get_constant_value.cpp",
@ -500,7 +518,6 @@ libabckit_host_unittest_action("abckit_gtests") {
"ut/isa/isa_dynamic/arrays/create_array_dynamic.cpp",
"ut/isa/isa_dynamic/async/async_dynamic.cpp",
"ut/isa/isa_dynamic/call_runtime/call_runtime_dynamic.cpp",
"ut/isa/isa_dynamic/catchphi/catchphi_dynamic.cpp",
"ut/isa/isa_dynamic/create/createdebugger.cpp",
"ut/isa/isa_dynamic/create/createobjectwithbuffer_dynamic.cpp",
"ut/isa/isa_dynamic/create/createobjectwithexcludedkeys_dynamic.cpp",
@ -546,7 +563,6 @@ libabckit_host_unittest_action("abckit_gtests") {
"ut/isa/isa_static/call/call_static_static.cpp",
"ut/isa/isa_static/call/call_virtual_static.cpp",
"ut/isa/isa_static/cast/cast_static.cpp",
"ut/isa/isa_static/catchphi/catchphi_static.cpp",
"ut/isa/isa_static/classes/classes_api.cpp",
"ut/isa/isa_static/cmp/create_cmp_static.cpp",
"ut/isa/isa_static/create_if/create_if_static.cpp",
@ -562,7 +578,7 @@ libabckit_host_unittest_action("abckit_gtests") {
"ut/isa/isa_static/throw/throw_static.cpp",
"ut/metadata_core/inspect_api/annotations/annotations_test.cpp",
"ut/metadata_core/inspect_api/classes/classes_test.cpp",
"ut/metadata_core/inspect_api/enumerators/modules_test.cpp",
"ut/metadata_core/inspect_api/enumerators/enumerators_test.cpp",
"ut/metadata_core/inspect_api/files/files_test.cpp",
"ut/metadata_core/inspect_api/literals/literals_test.cpp",
"ut/metadata_core/inspect_api/methods/methods_test.cpp",
@ -576,12 +592,9 @@ libabckit_host_unittest_action("abckit_gtests") {
"ut/metadata_core/modify_api/types/types_test.cpp",
"ut/metadata_core/modify_api/values/values_test.cpp",
# "wrong_ctx_tests/wrong_ctx_tests_ApiImpl_0.cpp",
# "wrong_ctx_tests/wrong_ctx_tests_ArktsInspectApiImpl_0.cpp",
# "wrong_ctx_tests/wrong_ctx_tests_ArktsModifyApiImpl_0.cpp",
"wrong_ctx_tests/wrong_ctx_tests_GraphApiImpl_0.cpp",
# "wrong_ctx_tests/wrong_ctx_tests_InspectApiImpl_0.cpp",
"wrong_ctx_tests/wrong_ctx_tests_IsaApiDynamicImpl_0.cpp",
"wrong_ctx_tests/wrong_ctx_tests_IsaApiDynamicImpl_1.cpp",
"wrong_ctx_tests/wrong_ctx_tests_IsaApiStaticImpl_0.cpp",

View File

@ -27,7 +27,7 @@
namespace libabckit::test {
class LibAbcKitCppTest : public ::testing::Test {};
// CC-OFFNXT(WordsTool.95 Google) sensitive word conflict
// CC-OFFNXT(WordsTool.95) sensitive word conflict
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace abckit;

View File

@ -322,40 +322,12 @@ void ReplaceInst(AbckitInst *what, AbckitInst *with)
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
}
void EnumerateAllMethods(AbckitFile *file, const std::function<void(AbckitCoreFunction *)> &cbUserFunc)
static void EnumerateAllMethodsInModule(AbckitFile *file, std::function<void(AbckitCoreNamespace *)> &cbNamespace,
std::function<void(AbckitCoreClass *)> &cbClass,
std::function<void(AbckitCoreFunction *)> &cbFunc)
{
std::function<void(AbckitCoreFunction *)> cbFunc = [&](AbckitCoreFunction *f) {
cbUserFunc(f);
g_implI->functionEnumerateNestedFunctions(f, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreClass *)> cbClass = [&](AbckitCoreClass *c) {
g_implI->classEnumerateMethods(c, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreNamespace *)> cbNamespce = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->namespaceEnumerateClasses(n, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->namespaceEnumerateTopLevelFunctions(n, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(f);
return true;
});
};
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
@ -375,6 +347,48 @@ void EnumerateAllMethods(AbckitFile *file, const std::function<void(AbckitCoreFu
});
}
void EnumerateAllMethods(AbckitFile *file, const std::function<void(AbckitCoreFunction *)> &cbUserFunc)
{
std::function<void(AbckitCoreFunction *)> cbFunc;
std::function<void(AbckitCoreClass *)> cbClass;
cbFunc = [&](AbckitCoreFunction *f) {
cbUserFunc(f);
g_implI->functionEnumerateNestedFunctions(f, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(f);
return true;
});
g_implI->functionEnumerateNestedClasses(f, (void *)&cbClass, [](AbckitCoreClass *f, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(f);
return true;
});
};
cbClass = [&](AbckitCoreClass *c) {
g_implI->classEnumerateMethods(c, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreNamespace *)> cbNamespace = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->namespaceEnumerateClasses(n, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->namespaceEnumerateTopLevelFunctions(n, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(f);
return true;
});
};
EnumerateAllMethodsInModule(file, cbNamespace, cbClass, cbFunc);
}
void AssertModuleVisitor([[maybe_unused]] AbckitCoreModule *module, [[maybe_unused]] void *data)
{
EXPECT_TRUE(module != nullptr);

View File

@ -341,7 +341,7 @@ void TestMode(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitInst *inst, Ab
auto *graph = OpenWrongModeFile(isDynamic);
g_dummyInsT1->graph = graph;
g_dummyModule->file = graph->file;
g_dummyMethod->m = g_dummyModule;
g_dummyMethod->owningModule = g_dummyModule;
auto *inst = apiToCheck(graph, g_dummyInsT1, g_dummyMethod, 0);
ASSERT_EQ(inst, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_MODE);
@ -403,7 +403,7 @@ void TestMode(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFunction *
{
auto *graph = OpenWrongModeFile(isDynamic);
g_dummyModule->file = graph->file;
g_dummyMethod->m = g_dummyModule;
g_dummyMethod->owningModule = g_dummyModule;
auto *inst = apiToCheck(graph, g_dummyMethod, 0);
ASSERT_EQ(inst, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_MODE);
@ -417,7 +417,7 @@ void TestMode(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFunction *
{
auto *graph = OpenWrongModeFile(isDynamic);
g_dummyModule->file = graph->file;
g_dummyMethod->m = g_dummyModule;
g_dummyMethod->owningModule = g_dummyModule;
auto *inst = apiToCheck(graph, g_dummyMethod, 0);
ASSERT_EQ(inst, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_MODE);
@ -500,7 +500,7 @@ void TestMode(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFunction *
auto *graph = OpenWrongModeFile(isDynamic);
g_dummyInsT1->graph = graph;
g_dummyModule->file = graph->file;
g_dummyMethod->m = g_dummyModule;
g_dummyMethod->owningModule = g_dummyModule;
auto *inst = apiToCheck(graph, g_dummyMethod, g_dummyLitarr, 0, g_dummyInsT1);
ASSERT_EQ(inst, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_MODE);
@ -659,7 +659,7 @@ void TestMode(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitInst *acc, Abc
auto *graph = OpenWrongModeFile(isDynamic);
g_dummyInsT1->graph = graph;
g_dummyModule->file = graph->file;
g_dummyMethod->m = g_dummyModule;
g_dummyMethod->owningModule = g_dummyModule;
auto *inst = apiToCheck(graph, g_dummyInsT1, g_dummyMethod, 0);
ASSERT_EQ(inst, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_MODE);

View File

@ -74,8 +74,8 @@ namespace libabckit::test::helpers_nullptr {
[[maybe_unused]] static const AbckitArktsImportFromDynamicModuleCreateParams
*g_constAbckitArktsImportfromdynamicmodulecreateparams =
reinterpret_cast<const AbckitArktsImportFromDynamicModuleCreateParams *>(0x1);
[[maybe_unused]] static const AbckitArktsExternalModuleCreateParams *g_constAbckitArktsExternalmodulecreateparams =
reinterpret_cast<const AbckitArktsExternalModuleCreateParams *>(0x1);
[[maybe_unused]] static const AbckitArktsV1ExternalModuleCreateParams *g_constAbckitArktsV1ExternalModuleCreateParams =
reinterpret_cast<const AbckitArktsV1ExternalModuleCreateParams *>(0x1);
[[maybe_unused]] static AbckitBasicBlock *g_abckitBasicblock = reinterpret_cast<AbckitBasicBlock *>(0x1);
[[maybe_unused]] static AbckitInst *g_abckitInst = reinterpret_cast<AbckitInst *>(0x1);
[[maybe_unused]] static void *g_void = reinterpret_cast<void *>(0x1);
@ -900,6 +900,14 @@ void TestNullptr(void (*apiToCheck)(AbckitCoreFunction *, void *, bool (*cb)(Abc
apiToCheck(g_abckitFunction, g_void, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(void (*apiToCheck)(AbckitCoreFunction *, void *, bool (*cb)(AbckitCoreClass *, void *)))
{
apiToCheck(nullptr, g_void, [](AbckitCoreClass *, void *) { return false; });
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
apiToCheck(g_abckitFunction, g_void, nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(AbckitFile *(*apiToCheck)(AbckitCoreFunction *))
{
ASSERT_EQ(apiToCheck(nullptr), nullptr);
@ -925,6 +933,16 @@ void TestNullptr(AbckitCoreClass *(*apiToCheck)(AbckitCoreFunction *))
ASSERT_EQ(apiToCheck(nullptr), nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(AbckitCoreFunction *(*apiToCheck)(AbckitCoreClass *))
{
ASSERT_EQ(apiToCheck(nullptr), nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(AbckitCoreFunction *(*apiToCheck)(AbckitCoreFunction *))
{
ASSERT_EQ(apiToCheck(nullptr), nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(bool (*apiToCheck)(AbckitCoreFunction *))
{
apiToCheck(nullptr);
@ -1748,9 +1766,9 @@ void TestNullptr(AbckitValue *(*apiToCheck)(AbckitFile *, bool))
ASSERT_EQ(apiToCheck(nullptr, 0), nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
}
void TestNullptr(AbckitArktsModule *(*apiToCheck)(AbckitFile *, const AbckitArktsExternalModuleCreateParams *))
void TestNullptr(AbckitArktsModule *(*apiToCheck)(AbckitFile *, const AbckitArktsV1ExternalModuleCreateParams *))
{
ASSERT_EQ(apiToCheck(nullptr, g_constAbckitArktsExternalmodulecreateparams), nullptr);
ASSERT_EQ(apiToCheck(nullptr, g_constAbckitArktsV1ExternalModuleCreateParams), nullptr);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_BAD_ARGUMENT);
ASSERT_EQ(apiToCheck(g_abckitFile, nullptr), nullptr);

View File

@ -166,11 +166,14 @@ void TestNullptr(uint32_t (*apiToCheck)(AbckitLiteral *));
void TestNullptr(uint64_t (*apiToCheck)(AbckitLiteral *));
void TestNullptr(uint8_t (*apiToCheck)(AbckitLiteral *));
void TestNullptr(void (*apiToCheck)(AbckitCoreFunction *, void *, bool (*cb)(AbckitCoreAnnotation *, void *)));
void TestNullptr(void (*apiToCheck)(AbckitCoreFunction *, void *, bool (*cb)(AbckitCoreClass *, void *)));
void TestNullptr(AbckitFile *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(AbckitGraph *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(AbckitCoreModule *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(AbckitString *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(AbckitCoreClass *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(AbckitCoreFunction *(*apiToCheck)(AbckitCoreClass *));
void TestNullptr(AbckitCoreFunction *(*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(bool (*apiToCheck)(AbckitCoreFunction *));
void TestNullptr(void (*apiToCheck)(AbckitCoreModule *, void *, bool (*cb)(AbckitCoreAnnotationInterface *, void *)));
void TestNullptr(void (*apiToCheck)(AbckitCoreModule *, void *, bool (*cb)(AbckitCoreFunction *, void *)));
@ -279,7 +282,7 @@ void TestNullptr(AbckitType *(*apiToCheck)(AbckitFile *, AbckitTypeId));
void TestNullptr(AbckitValue *(*apiToCheck)(AbckitFile *, double));
void TestNullptr(AbckitValue *(*apiToCheck)(AbckitFile *, const char *));
void TestNullptr(AbckitValue *(*apiToCheck)(AbckitFile *, bool));
void TestNullptr(AbckitArktsModule *(*apiToCheck)(AbckitFile *, const AbckitArktsExternalModuleCreateParams *));
void TestNullptr(AbckitArktsModule *(*apiToCheck)(AbckitFile *, const AbckitArktsV1ExternalModuleCreateParams *));
void TestNullptr(AbckitJsModule *(*apiToCheck)(AbckitFile *, const AbckitJsExternalModuleCreateParams *));
void TestNullptr(void (*apiToCheck)(AbckitCoreFunction *, AbckitGraph *));
void TestNullptr(AbckitJsExportDescriptor *(*apiToCheck)(AbckitJsModule *, AbckitJsModule *,

View File

@ -66,7 +66,7 @@ void TestWrongCtx(void (*apiToCheck)(AbckitCoreFunction *method, AbckitGraph *co
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD2->owningModule = g_dummyModulE2;
apiToCheck(g_dummyMethoD2, g_dummyGrapH1);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_WRONG_CTX);
@ -171,8 +171,8 @@ void TestWrongCtx(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFuncti
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD1->m = g_dummyModulE1;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD1->owningModule = g_dummyModulE1;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyGrapH1->file = g_dummyFilE1;
g_dummyGrapH2->file = g_dummyFilE2;
@ -304,8 +304,8 @@ void TestWrongCtx(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFuncti
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD1->m = g_dummyModulE1;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD1->owningModule = g_dummyModulE1;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyInsT1->graph = g_dummyGrapH1;
g_dummyInsT2->graph = g_dummyGrapH2;
@ -393,8 +393,8 @@ void TestWrongCtx(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitCoreFuncti
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD1->m = g_dummyModulE1;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD1->owningModule = g_dummyModulE1;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyGrapH1->file = g_dummyFilE1;
g_dummyGrapH2->file = g_dummyFilE2;
@ -410,8 +410,8 @@ void TestWrongCtx(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitInst *acc,
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD1->m = g_dummyModulE1;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD1->owningModule = g_dummyModulE1;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyInsT1->graph = g_dummyGrapH1;
g_dummyInsT2->graph = g_dummyGrapH2;
@ -584,7 +584,7 @@ void TestWrongCtx(void (*apiToCheck)(AbckitInst *input0, AbckitCoreFunction *met
{
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyInsT1->graph = g_dummyGrapH1;
@ -616,8 +616,8 @@ void TestWrongCtx(AbckitInst *(*apiToCheck)(AbckitGraph *graph, AbckitInst *inpu
g_dummyModulE1->file = g_dummyFilE1;
g_dummyModulE2->file = g_dummyFilE2;
g_dummyMethoD1->m = g_dummyModulE1;
g_dummyMethoD2->m = g_dummyModulE2;
g_dummyMethoD1->owningModule = g_dummyModulE1;
g_dummyMethoD2->owningModule = g_dummyModulE2;
g_dummyInsT1->graph = g_dummyGrapH1;
g_dummyInsT2->graph = g_dummyGrapH2;

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Before AOP:
class MyClass {
handle() {
@ -26,16 +25,3 @@ function main() {
}
main();
// // After AOP:
//
// class MyClass {
// handle() {
// print('file: har_A/src/MyClass, function: MyClass.handle')
// let t1 = Date.getTime()
// // business logic
// let t2 = Date.getTime()
// print('Ellapsed time:')
// print(t2 - t1)
// }
// }

View File

@ -31,21 +31,21 @@
namespace libabckit::test {
% case domain
% when "ArktsInspectApiImpl"
% when "ArktsInspectApi"
% getter = "AbckitGetArkTsInspectApiImpl"
% when "ArktsModifyApiImpl"
% when "ArktsModifyApi"
% getter = "AbckitGetArkTsModifyApiImpl"
% else
% getter = "AbckitGet" + domain
% end
%
% domain_var = 'g_' + domain[0].downcase + domain[1...-1]
static auto <%= domain_var %> = <%=getter%>(1);
static auto <%= domain_var %> = <%=getter%>(ABCKIT_VERSION_RELEASE_1_0_0);
class LibAbcKitNullptrTests<%=domain%><%=iteration%> : public ::testing::Test {};
% slice_start = index
% slice_end = index + slice_size
% slice_end = index + slice_size - 1
% api_funcs_arr[slice_start..slice_end].each do |api_func|
// Test: test-kind=api, api=<%= domain %>::<%= api_func %>,
// abc-kind=NoABC, category=negative-nullptr

View File

@ -34,6 +34,20 @@ static auto g_apiImp = AbckitGetApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
class LibAbcKitNullptrTestsApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=ApiImpl::closeFile,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsApiImpl0, closeFile)
{
helpers_nullptr::TestNullptr(g_apiImp->closeFile);
}
// Test: test-kind=api, api=ApiImpl::destroyGraph,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsApiImpl0, destroyGraph)
{
helpers_nullptr::TestNullptr(g_apiImp->destroyGraph);
}
// Test: test-kind=api, api=ApiImpl::openAbc,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsApiImpl0, openAbc)
@ -48,18 +62,4 @@ TEST_F(LibAbcKitNullptrTestsApiImpl0, writeAbc)
helpers_nullptr::TestNullptr(g_apiImp->writeAbc);
}
// Test: test-kind=api, api=ApiImpl::destroyGraph,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsApiImpl0, destroyGraph)
{
helpers_nullptr::TestNullptr(g_apiImp->destroyGraph);
}
// Test: test-kind=api, api=ApiImpl::closeFile,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsApiImpl0, closeFile)
{
helpers_nullptr::TestNullptr(g_apiImp->closeFile);
}
} // namespace libabckit::test

View File

@ -34,62 +34,6 @@ static auto g_arktsInspectApiImp = AbckitGetArktsInspectApiImpl(ABCKIT_VERSION_R
class LibAbcKitNullptrTestsArktsInspectApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsFunctionToCoreFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsFunctionToCoreFunction)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsFunctionToCoreFunction);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreModuleToArktsModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreModuleToArktsModule)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreModuleToArktsModule);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationToCoreAnnotation,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationToCoreAnnotation)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationToCoreAnnotation);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreNamespaceToArktsNamespace,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreNamespaceToArktsNamespace)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreNamespaceToArktsNamespace);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreFunctionToArktsFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreFunctionToArktsFunction)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreFunctionToArktsFunction);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsModuleToCoreModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsModuleToCoreModule)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsModuleToCoreModule);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationInterfaceToArktsAnnotationInterface,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationInterfaceToArktsAnnotationInterface)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationInterfaceToArktsAnnotationInterface);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationElementToCoreAnnotationElement,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationElementToCoreAnnotationElement)
@ -97,13 +41,6 @@ TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationElementToCoreAn
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationElementToCoreAnnotationElement);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreClassToArktsClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreClassToArktsClass)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreClassToArktsClass);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationInterfaceFieldToCoreAnnotationInterfaceField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationInterfaceFieldToCoreAnnotationInterfaceField)
@ -111,46 +48,18 @@ TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationInterfaceFieldT
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationInterfaceFieldToCoreAnnotationInterfaceField);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationElementToArktsAnnotationElement,
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationInterfaceToCoreAnnotationInterface,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationElementToArktsAnnotationElement)
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationInterfaceToCoreAnnotationInterface)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationElementToArktsAnnotationElement);
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationInterfaceToCoreAnnotationInterface);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsV1NamespaceGetConstructor,
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationToCoreAnnotation,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsV1NamespaceGetConstructor)
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationToCoreAnnotation)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsV1NamespaceGetConstructor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::functionIsNative,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, functionIsNative)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->functionIsNative);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreImportDescriptorToArktsImportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreImportDescriptorToArktsImportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreImportDescriptorToArktsImportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsExportDescriptorToCoreExportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsExportDescriptorToCoreExportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsExportDescriptorToCoreExportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreExportDescriptorToArktsExportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreExportDescriptorToArktsExportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreExportDescriptorToArktsExportDescriptor);
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationToCoreAnnotation);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsClassToCoreClass,
@ -160,25 +69,18 @@ TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsClassToCoreClass)
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsClassToCoreClass);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationToArktsAnnotation,
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsExportDescriptorToCoreExportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationToArktsAnnotation)
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsExportDescriptorToCoreExportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationToArktsAnnotation);
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsExportDescriptorToCoreExportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsNamespaceToCoreNamespace,
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsFunctionToCoreFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsNamespaceToCoreNamespace)
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsFunctionToCoreFunction)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsNamespaceToCoreNamespace);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsAnnotationInterfaceToCoreAnnotationInterface,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsAnnotationInterfaceToCoreAnnotationInterface)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsAnnotationInterfaceToCoreAnnotationInterface);
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsFunctionToCoreFunction);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsImportDescriptorToCoreImportDescriptor,
@ -188,4 +90,102 @@ TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsImportDescriptorToCoreImp
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsImportDescriptorToCoreImportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsModuleToCoreModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsModuleToCoreModule)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsModuleToCoreModule);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsNamespaceToCoreNamespace,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsNamespaceToCoreNamespace)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsNamespaceToCoreNamespace);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::arktsV1NamespaceGetConstructor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, arktsV1NamespaceGetConstructor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->arktsV1NamespaceGetConstructor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationElementToArktsAnnotationElement,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationElementToArktsAnnotationElement)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationElementToArktsAnnotationElement);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationInterfaceToArktsAnnotationInterface,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationInterfaceToArktsAnnotationInterface)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationInterfaceToArktsAnnotationInterface);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreAnnotationToArktsAnnotation,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreAnnotationToArktsAnnotation)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreAnnotationToArktsAnnotation);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreClassToArktsClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreClassToArktsClass)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreClassToArktsClass);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreExportDescriptorToArktsExportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreExportDescriptorToArktsExportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreExportDescriptorToArktsExportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreFunctionToArktsFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreFunctionToArktsFunction)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreFunctionToArktsFunction);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreImportDescriptorToArktsImportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreImportDescriptorToArktsImportDescriptor)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreImportDescriptorToArktsImportDescriptor);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreModuleToArktsModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreModuleToArktsModule)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreModuleToArktsModule);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::coreNamespaceToArktsNamespace,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, coreNamespaceToArktsNamespace)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->coreNamespaceToArktsNamespace);
}
// Test: test-kind=api, api=ArktsInspectApiImpl::functionIsNative,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsInspectApiImpl0, functionIsNative)
{
helpers_nullptr::TestNullptr(g_arktsInspectApiImp->functionIsNative);
}
} // namespace libabckit::test

View File

@ -34,20 +34,6 @@ static auto g_arktsModifyApiImp = AbckitGetArktsModifyApiImpl(ABCKIT_VERSION_REL
class LibAbcKitNullptrTestsArktsModifyApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleAddExportFromArktsV1ToArktsV1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleAddExportFromArktsV1ToArktsV1)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleAddExportFromArktsV1ToArktsV1);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::fileAddExternalModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, fileAddExternalModule)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->fileAddExternalModule);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationAddAnnotationElement,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationAddAnnotationElement)
@ -55,18 +41,18 @@ TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationAddAnnotationElement)
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationAddAnnotationElement);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleRemoveImport,
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationInterfaceAddField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleRemoveImport)
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationInterfaceAddField)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleRemoveImport);
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationInterfaceAddField);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::functionAddAnnotation,
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationInterfaceRemoveField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, functionAddAnnotation)
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationInterfaceRemoveField)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->functionAddAnnotation);
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationInterfaceRemoveField);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationRemoveAnnotationElement,
@ -76,20 +62,6 @@ TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationRemoveAnnotationEleme
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationRemoveAnnotationElement);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleAddImportFromArktsV1ToArktsV1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleAddImportFromArktsV1ToArktsV1)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleAddImportFromArktsV1ToArktsV1);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationInterfaceAddField,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationInterfaceAddField)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationInterfaceAddField);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::classAddAnnotation,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, classAddAnnotation)
@ -104,18 +76,18 @@ TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, classRemoveAnnotation)
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->classRemoveAnnotation);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleRemoveExport,
// Test: test-kind=api, api=ArktsModifyApiImpl::fileAddExternalModuleArktsV1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleRemoveExport)
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, fileAddExternalModuleArktsV1)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleRemoveExport);
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->fileAddExternalModuleArktsV1);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::annotationInterfaceRemoveField,
// Test: test-kind=api, api=ArktsModifyApiImpl::functionAddAnnotation,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, annotationInterfaceRemoveField)
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, functionAddAnnotation)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->annotationInterfaceRemoveField);
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->functionAddAnnotation);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::functionRemoveAnnotation,
@ -132,4 +104,32 @@ TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleAddAnnotationInterface)
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleAddAnnotationInterface);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleAddExportFromArktsV1ToArktsV1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleAddExportFromArktsV1ToArktsV1)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleAddExportFromArktsV1ToArktsV1);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleAddImportFromArktsV1ToArktsV1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleAddImportFromArktsV1ToArktsV1)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleAddImportFromArktsV1ToArktsV1);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleRemoveExport,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleRemoveExport)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleRemoveExport);
}
// Test: test-kind=api, api=ArktsModifyApiImpl::moduleRemoveImport,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsArktsModifyApiImpl0, moduleRemoveImport)
{
helpers_nullptr::TestNullptr(g_arktsModifyApiImp->moduleRemoveImport);
}
} // namespace libabckit::test

View File

@ -34,18 +34,151 @@ static auto g_graphApiImp = AbckitGetGraphApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
class LibAbcKitNullptrTestsGraphApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=GraphApiImpl::gInsertTryCatch,
// Test: test-kind=api, api=GraphApiImpl::bbAddInstBack,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gInsertTryCatch)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAddInstBack)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gInsertTryCatch);
helpers_nullptr::TestNullptr(g_graphApiImp->bbAddInstBack);
}
// Test: test-kind=api, api=GraphApiImpl::iSetFunction,
// Test: test-kind=api, api=GraphApiImpl::bbAddInstFront,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetFunction)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAddInstFront)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetFunction);
helpers_nullptr::TestNullptr(g_graphApiImp->bbAddInstFront);
}
// Test: test-kind=api, api=GraphApiImpl::bbAppendSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAppendSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbAppendSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::bbCheckDominance,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCheckDominance)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCheckDominance);
}
// Test: test-kind=api, api=GraphApiImpl::bbCreateCatchPhi,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCreateCatchPhi)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCreateCatchPhi);
}
// Test: test-kind=api, api=GraphApiImpl::bbCreateEmpty,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCreateEmpty)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCreateEmpty);
}
// Test: test-kind=api, api=GraphApiImpl::bbCreatePhi,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCreatePhi)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCreatePhi);
}
// Test: test-kind=api, api=GraphApiImpl::bbDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbDump);
}
// Test: test-kind=api, api=GraphApiImpl::bbEraseSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbEraseSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbEraseSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetFalseBranch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetFalseBranch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetFalseBranch);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetFirstInst,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetFirstInst)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetFirstInst);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetGraph,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetGraph)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetGraph);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetId,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetId)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetId);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetImmediateDominator,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetImmediateDominator)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetImmediateDominator);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetLastInst,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetLastInst)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetLastInst);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetNumberOfInstructions,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetNumberOfInstructions)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetNumberOfInstructions);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetPredBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetPredBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetPredBlock);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetPredBlockCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetPredBlockCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetPredBlockCount);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetSuccBlockCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetSuccBlockCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetSuccBlockCount);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetTrueBranch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetTrueBranch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetTrueBranch);
}
// Test: test-kind=api, api=GraphApiImpl::bbInsertSuccBlock,
@ -55,6 +188,20 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbInsertSuccBlock)
helpers_nullptr::TestNullptr(g_graphApiImp->bbInsertSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsCatch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsCatch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsCatch);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsCatchBegin,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsCatchBegin)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsCatchBegin);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsEnd,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsEnd)
@ -69,256 +216,11 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsLoopHead)
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsLoopHead);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetSuccBlockCount,
// Test: test-kind=api, api=GraphApiImpl::bbIsLoopPrehead,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetSuccBlockCount)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsLoopPrehead)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetSuccBlockCount);
}
// Test: test-kind=api, api=GraphApiImpl::iSetString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetString)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetString);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsCatchBegin,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsCatchBegin)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsCatchBegin);
}
// Test: test-kind=api, api=GraphApiImpl::gRunPassRemoveUnreachableBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gRunPassRemoveUnreachableBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gRunPassRemoveUnreachableBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetFirstInst,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetFirstInst)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetFirstInst);
}
// Test: test-kind=api, api=GraphApiImpl::bbAppendSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAppendSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbAppendSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gGetParameter,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetParameter)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetParameter);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantI64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantI64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantI64);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantI32,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantI32)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantI32);
}
// Test: test-kind=api, api=GraphApiImpl::bbSplitBlockAfterInstruction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbSplitBlockAfterInstruction)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbSplitBlockAfterInstruction);
}
// Test: test-kind=api, api=GraphApiImpl::iGetPrev,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetPrev)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetPrev);
}
// Test: test-kind=api, api=GraphApiImpl::bbCheckDominance,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCheckDominance)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCheckDominance);
}
// Test: test-kind=api, api=GraphApiImpl::iGetNext,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetNext)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetNext);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsTryBegin,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsTryBegin)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsTryBegin);
}
// Test: test-kind=api, api=GraphApiImpl::gGetIsa,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetIsa)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetIsa);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetId,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetId)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetId);
}
// Test: test-kind=api, api=GraphApiImpl::bbAddInstBack,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAddInstBack)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbAddInstBack);
}
// Test: test-kind=api, api=GraphApiImpl::gGetStartBasicBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetStartBasicBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetStartBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gVisitBlocksRpo,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gVisitBlocksRpo)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gVisitBlocksRpo);
}
// Test: test-kind=api, api=GraphApiImpl::iDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iDump);
}
// Test: test-kind=api, api=GraphApiImpl::iAppendInput,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iAppendInput)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iAppendInput);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantU64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantU64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantU64);
}
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueI64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueI64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueI64);
}
// Test: test-kind=api, api=GraphApiImpl::iVisitInputs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iVisitInputs)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iVisitInputs);
}
// Test: test-kind=api, api=GraphApiImpl::bbVisitSuccBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitSuccBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbVisitSuccBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::iGetImmediateCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetImmediateCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetImmediateCount);
}
// Test: test-kind=api, api=GraphApiImpl::iVisitUsers,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iVisitUsers)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iVisitUsers);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetFalseBranch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetFalseBranch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetFalseBranch);
}
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueF64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueF64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueF64);
}
// Test: test-kind=api, api=GraphApiImpl::iInsertAfter,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iInsertAfter)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iInsertAfter);
}
// Test: test-kind=api, api=GraphApiImpl::iGetInput,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetInput)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetInput);
}
// Test: test-kind=api, api=GraphApiImpl::bbEraseSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbEraseSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbEraseSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gGetFile,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetFile)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetFile);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetGraph,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetGraph)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetGraph);
}
// Test: test-kind=api, api=GraphApiImpl::iSetLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetLiteralArray)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetLiteralArray);
}
// Test: test-kind=api, api=GraphApiImpl::iInsertBefore,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iInsertBefore)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iInsertBefore);
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsLoopPrehead);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsStart,
@ -328,27 +230,6 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsStart)
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsStart);
}
// Test: test-kind=api, api=GraphApiImpl::bbDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbDump);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsLoopPrehead,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsLoopPrehead)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsLoopPrehead);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetNumberOfInstructions,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetNumberOfInstructions)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetNumberOfInstructions);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsTry,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsTry)
@ -356,123 +237,11 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsTry)
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsTry);
}
// Test: test-kind=api, api=GraphApiImpl::iCheckIsCall,
// Test: test-kind=api, api=GraphApiImpl::bbIsTryBegin,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iCheckIsCall)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsTryBegin)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iCheckIsCall);
}
// Test: test-kind=api, api=GraphApiImpl::iGetFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetFunction)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetFunction);
}
// Test: test-kind=api, api=GraphApiImpl::iGetString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetString)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetString);
}
// Test: test-kind=api, api=GraphApiImpl::iSetInputs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetInputs)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetInputs);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetImmediateDominator,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetImmediateDominator)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetImmediateDominator);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetSuccBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetSuccBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetSuccBlock);
}
// Test: test-kind=api, api=GraphApiImpl::iGetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetType)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetType);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetPredBlockCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetPredBlockCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetPredBlockCount);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetPredBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetPredBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetPredBlock);
}
// Test: test-kind=api, api=GraphApiImpl::iGetId,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetId)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetId);
}
// Test: test-kind=api, api=GraphApiImpl::iGetUserCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetUserCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetUserCount);
}
// Test: test-kind=api, api=GraphApiImpl::gDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gDump);
}
// Test: test-kind=api, api=GraphApiImpl::iRemove,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iRemove)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iRemove);
}
// Test: test-kind=api, api=GraphApiImpl::bbCreatePhi,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCreatePhi)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCreatePhi);
}
// Test: test-kind=api, api=GraphApiImpl::gGetNumberOfBasicBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetNumberOfBasicBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetNumberOfBasicBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::iGetBasicBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetBasicBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantF64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantF64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantF64);
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsTryBegin);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsTryEnd,
@ -482,6 +251,20 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsTryEnd)
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsTryEnd);
}
// Test: test-kind=api, api=GraphApiImpl::bbRemoveAllInsts,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbRemoveAllInsts)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbRemoveAllInsts);
}
// Test: test-kind=api, api=GraphApiImpl::bbSplitBlockAfterInstruction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbSplitBlockAfterInstruction)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbSplitBlockAfterInstruction);
}
// Test: test-kind=api, api=GraphApiImpl::bbVisitDominatedBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitDominatedBlocks)
@ -489,27 +272,6 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitDominatedBlocks)
helpers_nullptr::TestNullptr(g_graphApiImp->bbVisitDominatedBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetTrueBranch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetTrueBranch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetTrueBranch);
}
// Test: test-kind=api, api=GraphApiImpl::iSetImmediate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetImmediate)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetImmediate);
}
// Test: test-kind=api, api=GraphApiImpl::iGetImmediate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetImmediate)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetImmediate);
}
// Test: test-kind=api, api=GraphApiImpl::bbVisitPredBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitPredBlocks)
@ -517,25 +279,46 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitPredBlocks)
helpers_nullptr::TestNullptr(g_graphApiImp->bbVisitPredBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueU64,
// Test: test-kind=api, api=GraphApiImpl::bbVisitSuccBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueU64)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbVisitSuccBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueU64);
helpers_nullptr::TestNullptr(g_graphApiImp->bbVisitSuccBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::bbGetLastInst,
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantF64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbGetLastInst)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantF64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbGetLastInst);
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantF64);
}
// Test: test-kind=api, api=GraphApiImpl::iGetLiteralArray,
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantI32,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetLiteralArray)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantI32)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetLiteralArray);
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantI32);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantI64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantI64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantI64);
}
// Test: test-kind=api, api=GraphApiImpl::gCreateConstantU64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gCreateConstantU64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gCreateConstantU64);
}
// Test: test-kind=api, api=GraphApiImpl::gDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gDump);
}
// Test: test-kind=api, api=GraphApiImpl::gGetBasicBlock,
@ -545,6 +328,83 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetBasicBlock)
helpers_nullptr::TestNullptr(g_graphApiImp->gGetBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gGetEndBasicBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetEndBasicBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetEndBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gGetFile,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetFile)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetFile);
}
// Test: test-kind=api, api=GraphApiImpl::gGetIsa,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetIsa)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetIsa);
}
// Test: test-kind=api, api=GraphApiImpl::gGetNumberOfBasicBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetNumberOfBasicBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetNumberOfBasicBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::gGetNumberOfParameters,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetNumberOfParameters)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetNumberOfParameters);
}
// Test: test-kind=api, api=GraphApiImpl::gGetParameter,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetParameter)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetParameter);
}
// Test: test-kind=api, api=GraphApiImpl::gGetStartBasicBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetStartBasicBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetStartBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::gInsertTryCatch,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gInsertTryCatch)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gInsertTryCatch);
}
// Test: test-kind=api, api=GraphApiImpl::gRunPassRemoveUnreachableBlocks,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gRunPassRemoveUnreachableBlocks)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gRunPassRemoveUnreachableBlocks);
}
// Test: test-kind=api, api=GraphApiImpl::gVisitBlocksRpo,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gVisitBlocksRpo)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gVisitBlocksRpo);
}
// Test: test-kind=api, api=GraphApiImpl::iAppendInput,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iAppendInput)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iAppendInput);
}
// Test: test-kind=api, api=GraphApiImpl::iCheckDominance,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iCheckDominance)
@ -552,6 +412,34 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iCheckDominance)
helpers_nullptr::TestNullptr(g_graphApiImp->iCheckDominance);
}
// Test: test-kind=api, api=GraphApiImpl::iCheckIsCall,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iCheckIsCall)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iCheckIsCall);
}
// Test: test-kind=api, api=GraphApiImpl::iDump,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iDump)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iDump);
}
// Test: test-kind=api, api=GraphApiImpl::iGetBasicBlock,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetBasicBlock)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetBasicBlock);
}
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueF64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueF64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueF64);
}
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueI32,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueI32)
@ -559,32 +447,53 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueI32)
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueI32);
}
// Test: test-kind=api, api=GraphApiImpl::bbClear,
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueI64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbClear)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueI64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbClear);
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueI64);
}
// Test: test-kind=api, api=GraphApiImpl::bbIsCatch,
// Test: test-kind=api, api=GraphApiImpl::iGetConstantValueU64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbIsCatch)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetConstantValueU64)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbIsCatch);
helpers_nullptr::TestNullptr(g_graphApiImp->iGetConstantValueU64);
}
// Test: test-kind=api, api=GraphApiImpl::bbAddInstFront,
// Test: test-kind=api, api=GraphApiImpl::iGetFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbAddInstFront)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetFunction)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbAddInstFront);
helpers_nullptr::TestNullptr(g_graphApiImp->iGetFunction);
}
// Test: test-kind=api, api=GraphApiImpl::bbCreateEmpty,
// Test: test-kind=api, api=GraphApiImpl::iGetId,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, bbCreateEmpty)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetId)
{
helpers_nullptr::TestNullptr(g_graphApiImp->bbCreateEmpty);
helpers_nullptr::TestNullptr(g_graphApiImp->iGetId);
}
// Test: test-kind=api, api=GraphApiImpl::iGetImmediate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetImmediate)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetImmediate);
}
// Test: test-kind=api, api=GraphApiImpl::iGetImmediateCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetImmediateCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetImmediateCount);
}
// Test: test-kind=api, api=GraphApiImpl::iGetInput,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetInput)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetInput);
}
// Test: test-kind=api, api=GraphApiImpl::iGetInputCount,
@ -594,6 +503,83 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetInputCount)
helpers_nullptr::TestNullptr(g_graphApiImp->iGetInputCount);
}
// Test: test-kind=api, api=GraphApiImpl::iGetLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetLiteralArray)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetLiteralArray);
}
// Test: test-kind=api, api=GraphApiImpl::iGetNext,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetNext)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetNext);
}
// Test: test-kind=api, api=GraphApiImpl::iGetPrev,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetPrev)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetPrev);
}
// Test: test-kind=api, api=GraphApiImpl::iGetString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetString)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetString);
}
// Test: test-kind=api, api=GraphApiImpl::iGetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetType)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetType);
}
// Test: test-kind=api, api=GraphApiImpl::iGetUserCount,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iGetUserCount)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iGetUserCount);
}
// Test: test-kind=api, api=GraphApiImpl::iInsertAfter,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iInsertAfter)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iInsertAfter);
}
// Test: test-kind=api, api=GraphApiImpl::iInsertBefore,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iInsertBefore)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iInsertBefore);
}
// Test: test-kind=api, api=GraphApiImpl::iRemove,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iRemove)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iRemove);
}
// Test: test-kind=api, api=GraphApiImpl::iSetFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetFunction)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetFunction);
}
// Test: test-kind=api, api=GraphApiImpl::iSetImmediate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetImmediate)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetImmediate);
}
// Test: test-kind=api, api=GraphApiImpl::iSetInput,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetInput)
@ -601,11 +587,39 @@ TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetInput)
helpers_nullptr::TestNullptr(g_graphApiImp->iSetInput);
}
// Test: test-kind=api, api=GraphApiImpl::gGetEndBasicBlock,
// Test: test-kind=api, api=GraphApiImpl::iSetInputs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, gGetEndBasicBlock)
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetInputs)
{
helpers_nullptr::TestNullptr(g_graphApiImp->gGetEndBasicBlock);
helpers_nullptr::TestNullptr(g_graphApiImp->iSetInputs);
}
// Test: test-kind=api, api=GraphApiImpl::iSetLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetLiteralArray)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetLiteralArray);
}
// Test: test-kind=api, api=GraphApiImpl::iSetString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iSetString)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iSetString);
}
// Test: test-kind=api, api=GraphApiImpl::iVisitInputs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iVisitInputs)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iVisitInputs);
}
// Test: test-kind=api, api=GraphApiImpl::iVisitUsers,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsGraphApiImpl0, iVisitUsers)
{
helpers_nullptr::TestNullptr(g_graphApiImp->iVisitUsers);
}
} // namespace libabckit::test

View File

@ -34,230 +34,6 @@ static auto g_isaApiStaticImp = AbckitGetIsaApiStaticImpl(ABCKIT_VERSION_RELEASE
class LibAbcKitNullptrTestsIsaApiStaticImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=IsaApiStaticImpl::iSetTargetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetTargetType)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetTargetType);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLenArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLenArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLenArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMod,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMod)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMod);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMulI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMulI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMulI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadConstArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadConstArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadConstArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNewArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNewArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNewArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateSub,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateSub)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateSub);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateInitObject,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateInitObject)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateInitObject);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAddI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAddI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAddI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateDivI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateDivI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateDivI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iSetClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetClass)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetClass);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNewObject,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNewObject)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNewObject);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetOpcode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetOpcode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetOpcode);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShr,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShr)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShr);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateEquals,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateEquals)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateEquals);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCmp,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCmp)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCmp);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAShrI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAShrI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAShrI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNot,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNot)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNot);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCatchPhi,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCatchPhi)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCatchPhi);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateThrow,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateThrow)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateThrow);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetTargetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetTargetType)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetTargetType);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateStoreArrayWide,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateStoreArrayWide)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateStoreArrayWide);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAdd,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAdd)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAdd);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateReturn,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateReturn)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateReturn);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iSetConditionCode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetConditionCode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetConditionCode);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateReturnVoid,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateReturnVoid)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateReturnVoid);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNeg,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNeg)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNeg);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateOrI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateOrI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateOrI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateStoreArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateStoreArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateStoreArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCallStatic,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCallStatic)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCallStatic);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShlI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShlI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShlI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadString)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadString);
}
// Test: test-kind=api, api=IsaApiStaticImpl::gCreateNullPtr,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, gCreateNullPtr)
@ -265,27 +41,6 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, gCreateNullPtr)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->gCreateNullPtr);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateDiv,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateDiv)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateDiv);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetClass)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetClass);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAShr,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAShr)
@ -293,39 +48,25 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAShr)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAShr);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateIsUndefined,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAShrI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateIsUndefined)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAShrI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateIsUndefined);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAShrI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCallVirtual,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAdd,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCallVirtual)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAdd)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCallVirtual);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAdd);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAndI,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAddI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAndI)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAddI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAndI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCheckCast,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCheckCast)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCheckCast);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetConditionCode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetConditionCode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetConditionCode);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAddI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAnd,
@ -335,6 +76,27 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAnd)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAnd);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateAndI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateAndI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateAndI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCallStatic,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCallStatic)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCallStatic);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCallVirtual,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCallVirtual)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCallVirtual);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCast,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCast)
@ -342,18 +104,39 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCast)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCast);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateXorI,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCheckCast,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateXorI)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCheckCast)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateXorI);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCheckCast);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadUndefined,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateCmp,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadUndefined)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateCmp)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadUndefined);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateCmp);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateDiv,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateDiv)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateDiv);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateDivI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateDivI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateDivI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateEquals,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateEquals)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateEquals);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateIf,
@ -363,18 +146,11 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateIf)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateIf);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShl,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateInitObject,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShl)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateInitObject)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShl);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateXor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateXor)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateXor);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateInitObject);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateIsInstance,
@ -384,25 +160,53 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateIsInstance)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateIsInstance);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateOr,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateIsUndefined,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateOr)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateIsUndefined)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateOr);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateIsUndefined);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShrI,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLenArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShrI)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLenArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShrI);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLenArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMul,
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMul)
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMul);
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadConstArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadConstArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadConstArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadString)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadString);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateLoadUndefined,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateLoadUndefined)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateLoadUndefined);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMod,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMod)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMod);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateModI,
@ -412,6 +216,125 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateModI)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateModI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMul,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMul)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMul);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateMulI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateMulI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateMulI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNeg,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNeg)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNeg);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNewArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNewArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNewArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNewObject,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNewObject)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNewObject);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateNot,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateNot)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateNot);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateOr,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateOr)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateOr);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateOrI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateOrI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateOrI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateReturn,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateReturn)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateReturn);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateReturnVoid,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateReturnVoid)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateReturnVoid);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShl,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShl)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShl);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShlI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShlI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShlI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShr,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShr)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShr);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateShrI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateShrI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateShrI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateStoreArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateStoreArray)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateStoreArray);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateStoreArrayWide,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateStoreArrayWide)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateStoreArrayWide);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateSub,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateSub)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateSub);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateSubI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateSubI)
@ -419,4 +342,74 @@ TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateSubI)
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateSubI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateThrow,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateThrow)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateThrow);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateXor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateXor)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateXor);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iCreateXorI,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iCreateXorI)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iCreateXorI);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetClass)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetClass);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetConditionCode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetConditionCode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetConditionCode);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetOpcode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetOpcode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetOpcode);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iGetTargetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iGetTargetType)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iGetTargetType);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iSetClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetClass)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetClass);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iSetConditionCode,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetConditionCode)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetConditionCode);
}
// Test: test-kind=api, api=IsaApiStaticImpl::iSetTargetType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsIsaApiStaticImpl0, iSetTargetType)
{
helpers_nullptr::TestNullptr(g_isaApiStaticImp->iSetTargetType);
}
} // namespace libabckit::test

View File

@ -34,46 +34,11 @@ static auto g_jsInspectApiImp = AbckitGetJsInspectApiImpl(ABCKIT_VERSION_RELEASE
class LibAbcKitNullptrTestsJsInspectApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=JsInspectApiImpl::coreFunctionToJsFunction,
// Test: test-kind=api, api=JsInspectApiImpl::coreClassToJsClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreFunctionToJsFunction)
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreClassToJsClass)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreFunctionToJsFunction);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsFunctionToCoreFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsFunctionToCoreFunction)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsFunctionToCoreFunction);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsModuleToCoreModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsModuleToCoreModule)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsModuleToCoreModule);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsClassToCoreClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsClassToCoreClass)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsClassToCoreClass);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreModuleToJsModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreModuleToJsModule)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreModuleToJsModule);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreImportDescriptorToJsImportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreImportDescriptorToJsImportDescriptor)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreImportDescriptorToJsImportDescriptor);
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreClassToJsClass);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreExportDescriptorToJsExportDescriptor,
@ -83,6 +48,34 @@ TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreExportDescriptorToJsExportDes
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreExportDescriptorToJsExportDescriptor);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreFunctionToJsFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreFunctionToJsFunction)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreFunctionToJsFunction);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreImportDescriptorToJsImportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreImportDescriptorToJsImportDescriptor)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreImportDescriptorToJsImportDescriptor);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreModuleToJsModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreModuleToJsModule)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreModuleToJsModule);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsClassToCoreClass,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsClassToCoreClass)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsClassToCoreClass);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsExportDescriptorToCoreExportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsExportDescriptorToCoreExportDescriptor)
@ -90,6 +83,13 @@ TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsExportDescriptorToCoreExportDes
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsExportDescriptorToCoreExportDescriptor);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsFunctionToCoreFunction,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsFunctionToCoreFunction)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsFunctionToCoreFunction);
}
// Test: test-kind=api, api=JsInspectApiImpl::jsImportDescriptorToCoreImportDescriptor,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsImportDescriptorToCoreImportDescriptor)
@ -97,11 +97,11 @@ TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsImportDescriptorToCoreImportDes
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsImportDescriptorToCoreImportDescriptor);
}
// Test: test-kind=api, api=JsInspectApiImpl::coreClassToJsClass,
// Test: test-kind=api, api=JsInspectApiImpl::jsModuleToCoreModule,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, coreClassToJsClass)
TEST_F(LibAbcKitNullptrTestsJsInspectApiImpl0, jsModuleToCoreModule)
{
helpers_nullptr::TestNullptr(g_jsInspectApiImp->coreClassToJsClass);
helpers_nullptr::TestNullptr(g_jsInspectApiImp->jsModuleToCoreModule);
}
} // namespace libabckit::test

View File

@ -41,6 +41,13 @@ TEST_F(LibAbcKitNullptrTestsJsModifyApiImpl0, fileAddExternalModule)
helpers_nullptr::TestNullptr(g_jsModifyApiImp->fileAddExternalModule);
}
// Test: test-kind=api, api=JsModifyApiImpl::moduleAddExportFromJsToJs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsModifyApiImpl0, moduleAddExportFromJsToJs)
{
helpers_nullptr::TestNullptr(g_jsModifyApiImp->moduleAddExportFromJsToJs);
}
// Test: test-kind=api, api=JsModifyApiImpl::moduleAddImportFromJsToJs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsModifyApiImpl0, moduleAddImportFromJsToJs)
@ -62,11 +69,4 @@ TEST_F(LibAbcKitNullptrTestsJsModifyApiImpl0, moduleRemoveImport)
helpers_nullptr::TestNullptr(g_jsModifyApiImp->moduleRemoveImport);
}
// Test: test-kind=api, api=JsModifyApiImpl::moduleAddExportFromJsToJs,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsJsModifyApiImpl0, moduleAddExportFromJsToJs)
{
helpers_nullptr::TestNullptr(g_jsModifyApiImp->moduleAddExportFromJsToJs);
}
} // namespace libabckit::test

View File

@ -34,32 +34,11 @@ static auto g_modifyApiImp = AbckitGetModifyApiImpl(ABCKIT_VERSION_RELEASE_1_0_0
class LibAbcKitNullptrTestsModifyApiImpl0 : public ::testing::Test {};
// Test: test-kind=api, api=ModifyApiImpl::createLiteralString,
// Test: test-kind=api, api=ModifyApiImpl::createLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralString)
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralArray)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralString);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU8,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU8)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU8);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueDouble,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueDouble)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueDouble);
}
// Test: test-kind=api, api=ModifyApiImpl::createType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createType)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createType);
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralArray);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralArrayValue,
@ -69,18 +48,11 @@ TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralArrayValue)
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralArrayValue);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU32,
// Test: test-kind=api, api=ModifyApiImpl::createLiteralBool,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU32)
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralBool)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU32);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralArray)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralArray);
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralBool);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralDouble,
@ -90,6 +62,13 @@ TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralDouble)
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralDouble);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralFloat,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralFloat)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralFloat);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralLiteralArray,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralLiteralArray)
@ -97,55 +76,6 @@ TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralLiteralArray)
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralLiteralArray);
}
// Test: test-kind=api, api=ModifyApiImpl::createString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createString)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createString);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueU1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueU1)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueU1);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU64)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU64);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralBool,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralBool)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralBool);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueString)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueString);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralMethodAffiliate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralMethodAffiliate)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralMethodAffiliate);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU16,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU16)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU16);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralMethod,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralMethod)
@ -153,18 +83,46 @@ TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralMethod)
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralMethod);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralFloat,
// Test: test-kind=api, api=ModifyApiImpl::createLiteralMethodAffiliate,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralFloat)
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralMethodAffiliate)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralFloat);
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralMethodAffiliate);
}
// Test: test-kind=api, api=ModifyApiImpl::functionSetGraph,
// Test: test-kind=api, api=ModifyApiImpl::createLiteralString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, functionSetGraph)
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralString)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->functionSetGraph);
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralString);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU16,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU16)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU16);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU32,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU32)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU32);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU64,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU64)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU64);
}
// Test: test-kind=api, api=ModifyApiImpl::createLiteralU8,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createLiteralU8)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createLiteralU8);
}
// Test: test-kind=api, api=ModifyApiImpl::createReferenceType,
@ -174,4 +132,46 @@ TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createReferenceType)
helpers_nullptr::TestNullptr(g_modifyApiImp->createReferenceType);
}
// Test: test-kind=api, api=ModifyApiImpl::createString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createString)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createString);
}
// Test: test-kind=api, api=ModifyApiImpl::createType,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createType)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createType);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueDouble,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueDouble)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueDouble);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueString,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueString)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueString);
}
// Test: test-kind=api, api=ModifyApiImpl::createValueU1,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, createValueU1)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->createValueU1);
}
// Test: test-kind=api, api=ModifyApiImpl::functionSetGraph,
// abc-kind=NoABC, category=negative-nullptr
TEST_F(LibAbcKitNullptrTestsModifyApiImpl0, functionSetGraph)
{
helpers_nullptr::TestNullptr(g_modifyApiImp->functionSetGraph);
}
} // namespace libabckit::test

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Before AOP:
class MyClass {
handle() {
@ -30,16 +29,3 @@ function main() {
}
main();
// // After AOP:
//
// class MyClass {
// handle() {
// print('file: har_A/src/MyClass, function: MyClass.handle')
// let t1 = Date.getTime()
// // business logic
// let t2 = Date.getTime()
// print('Ellapsed time:')
// print(t2 - t1)
// }
// }

View File

@ -26,7 +26,7 @@
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
static auto g_impl = AbckitGetApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
static auto g_implI = AbckitGetInspectApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
@ -213,7 +213,7 @@ static std::vector<helpers::BBSchema<AbckitIsaApiDynamicOpcode>> GetCorrectBBSch
}
// CC-OFFNXT(huge_method, C_RULE_ID_FUNCTION_SIZE) test, solid logic
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestDynamicAddLog)
TEST_F(AbckitScenarioTest, LibAbcKitTestDynamicAddLog)
{
auto output = helpers::ExecuteDynamicAbc(ABCKIT_ABC_DIR "scenarios/add_log/add_log_dynamic.abc", "add_log_dynamic");
EXPECT_TRUE(helpers::Match(output, "abckit\n"));

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Before AOP:
function ConsoleLogStr(a: string) {
console.log(a)
@ -36,24 +35,3 @@ function main() {
let c = new MyClass();
c.handle();
}
// // After AOP:
//
// function ConsoleLog(a: string) {
// console.log(a)
// }
// function DateGetTime(): number {
// return (new Date()).getTime()
// }
//
// class MyClass {
// handle() {
// ConsoleLogStr("file: har_A/src/MyClass; function: MyClass.handle")
// let t1 = DateGetTime()
// // business logic
// let t2 = DateGetTime()
// ConsoleLogStr("time consume: ")
// ConsoleLogNum(t2 - t1)
// }
// }

View File

@ -89,10 +89,10 @@ static void TransformIr(AbckitGraph *graph, UserData *userData)
});
}
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS2, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestStaticAddLog)
TEST_F(AbckitScenarioTest, LibAbcKitTestStaticAddLog)
{
auto output = helpers::ExecuteStaticAbc(ABCKIT_ABC_DIR "scenarios/add_log/add_log_static.abc",
"add_log_static/ETSGLOBAL", "main");

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Before AOP:
function throwableApi() {
print('THROW');
@ -33,30 +32,3 @@ function main() {
}
main();
// After AOP:
// function throwableApi() {
// print('THROW');
// throw new Error('DUMMY_ERROR');
// }
//
// class Handler {
// run() {
// let tmp;
// try {
// tmp = throwableApi();
// } catch(e) {
// print(e);
// tmp = false;
// }
// return tmp;
// }
// }
//
// function main() {
// let c = new Handler();
// print(c.run());
// }
//
// main()

View File

@ -26,7 +26,7 @@
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
static auto g_impl = AbckitGetApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
static auto g_implI = AbckitGetInspectApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
@ -52,7 +52,7 @@ static void TransformIr(AbckitGraph *graph, UserData *userData)
// Fill catchBlock
AbckitBasicBlock *catchBlock = g_implG->bbCreateEmpty(graph);
AbckitInst *catchPhi = g_dynG->iCreateCatchPhi(graph, catchBlock, 0);
AbckitInst *catchPhi = g_implG->bbCreateCatchPhi(catchBlock, 0);
AbckitInst *print = g_dynG->iCreateTryldglobalbyname(graph, userData->print);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
g_implG->bbAddInstBack(catchBlock, print);
@ -73,7 +73,7 @@ static void TransformIr(AbckitGraph *graph, UserData *userData)
}
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestDynamicAddTryCatch)
TEST_F(AbckitScenarioTest, LibAbcKitTestDynamicAddTryCatch)
{
auto output =
helpers::ExecuteDynamicAbc(ABCKIT_ABC_DIR "scenarios/add_try_catch/dynamic/add_try_catch.abc", "add_try_catch");

View File

@ -20,10 +20,10 @@
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestApiScannerDynamic)
TEST_F(AbckitScenarioTest, LibAbcKitTestApiScannerDynamic)
{
const auto version = ABCKIT_VERSION_RELEASE_1_0_0;
auto *impl = AbckitGetApiImpl(version);

View File

@ -95,10 +95,10 @@ bool CheckRessult(std::unordered_map<std::string, int> &methodsMap)
return true;
}
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS2, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestApiScannerStatic)
TEST_F(AbckitScenarioTest, LibAbcKitTestApiScannerStatic)
{
AbckitFile *file = g_impl->openAbc(ABCKIT_ABC_DIR "scenarios/api_scanner/static/api_scanner_static.abc");

View File

@ -64,7 +64,7 @@ static bool MethodHasBranch(const std::string &moduleName, const std::string &me
return ret;
}
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
static const std::string DIR = std::string(ABCKIT_ABC_DIR "scenarios/branch_eliminator/dynamic/");
static const std::string INPUT = DIR + "branch_eliminator.abc";
@ -114,13 +114,13 @@ static void GeneralBranchEliminatorTest(bool configIsDebugFinal)
}
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestBranchEliminatorDynamic1)
TEST_F(AbckitScenarioTest, LibAbcKitTestBranchEliminatorDynamic1)
{
GeneralBranchEliminatorTest(false);
}
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestBranchEliminatorDynamic2)
TEST_F(AbckitScenarioTest, LibAbcKitTestBranchEliminatorDynamic2)
{
GeneralBranchEliminatorTest(true);
}

View File

@ -22,10 +22,10 @@
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestParameterCheck)
TEST_F(AbckitScenarioTest, LibAbcKitTestParameterCheck)
{
static constexpr auto VERSION = ABCKIT_VERSION_RELEASE_1_0_0;
static constexpr auto INPUT_PATH = ABCKIT_ABC_DIR "scenarios/parameter_check/dynamic/parameter_check.abc";

View File

@ -64,10 +64,10 @@ void TransformIR(AbckitGraph *graph)
g_implG->bbAddInstBack(falseBB, ret);
}
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS2, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestStaticParameterCheck)
TEST_F(AbckitScenarioTest, LibAbcKitTestStaticParameterCheck)
{
auto output = helpers::ExecuteStaticAbc(ABCKIT_ABC_DIR "scenarios/parameter_check/parameter_check_static.abc",
"parameter_check_static/ETSGLOBAL", "main");

View File

@ -15,7 +15,7 @@
export class LinearLayout {
num_: number;
setOrientation(num: number) {
setOrientation(num: number): void {
this.num_ = num;
}

View File

@ -14,10 +14,10 @@
*/
import {
LinearLayout
} from './modules/layout'
} from './modules/layout';
class MyClass {
foo() {
foo(): void {
let appColumn = new LinearLayout();
appColumn.setOrientation(3);
print(appColumn.getOrientation());

View File

@ -35,12 +35,12 @@ static auto g_implG = AbckitGetGraphApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
static auto g_dynG = AbckitGetIsaApiDynamicImpl(ABCKIT_VERSION_RELEASE_1_0_0);
static auto g_implArkM = AbckitGetArktsModifyApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
static constexpr auto API_CLASS_NAME = "ApiControl";
static constexpr auto API_METHOD_NAME = "fixOrientationLinearLayout";
static constexpr auto API_MODULE_NAME = "modules/ApiControl";
static constexpr auto ANNOTATION_INTERFACE_NAME = "CallSiteReplacement";
constexpr auto API_CLASS_NAME = "ApiControl";
constexpr auto API_METHOD_NAME = "fixOrientationLinearLayout";
constexpr auto API_MODULE_NAME = "modules/ApiControl";
constexpr auto ANNOTATION_INTERFACE_NAME = "CallSiteReplacement";
struct UserData {
AbckitString *targetClass;
@ -182,7 +182,7 @@ static void ClassReplaceCallSite(VisitHelper &visitor, UserData &ud, AbckitCoreC
}
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestDynamicReplaceCallSite)
TEST_F(AbckitScenarioTest, LibAbcKitTestDynamicReplaceCallSite)
{
std::string inputPath = ABCKIT_ABC_DIR "scenarios/replace_call_site/dynamic/replace_call_site.abc";
std::string outputPath = ABCKIT_ABC_DIR "scenarios/replace_call_site/dynamic/replace_call_site_modified.abc";

View File

@ -67,10 +67,10 @@ void TransformIR(ReplaceContext *rctx)
VisitAllBBs(rctx, start, visitedBlocks);
}
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS2, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestReplaceCallSite)
TEST_F(AbckitScenarioTest, LibAbcKitTestReplaceCallSite)
{
auto output = helpers::ExecuteStaticAbc(ABCKIT_ABC_DIR "scenarios/replace_callsite/replace_callsite_static.abc",
"replace_callsite_static/ETSGLOBAL", "main");

View File

@ -16,5 +16,4 @@ import {
IRouterHandler
} from './IRouterHandler';
export let routerMap = new Map < string,
IRouterHandler > ([]);
export let routerMap = new Map<string, IRouterHandler>([]);

View File

@ -34,7 +34,7 @@ static const std::string ROUTER_MAP_FILE_MODULE_NAME = "modules/routerMap";
static const std::string ROUTER_ANNOTATION_NAME = "Router";
static const std::string FUNC_MAIN_0 = "func_main_0";
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
struct RouterAnnotation {
AbckitCoreClass *owner;
@ -226,7 +226,7 @@ static bool ClassHasAnnotation(VisitHelper &visitor, const UserData &ud)
}
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestRouterTable)
TEST_F(AbckitScenarioTest, LibAbcKitTestRouterTable)
{
std::string inputPath = ABCKIT_ABC_DIR "scenarios/router_table/dynamic/router_table.abc";
std::string outputPath = ABCKIT_ABC_DIR "scenarios/router_table/dynamic/router_table_modified.abc";

View File

@ -22,10 +22,10 @@
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestScanSubclasses)
TEST_F(AbckitScenarioTest, LibAbcKitTestScanSubclasses)
{
// CC-OFFNXT(G.NAM.03) project code style
constexpr auto VERSION = ABCKIT_VERSION_RELEASE_1_0_0;

View File

@ -91,10 +91,10 @@ auto g_libAbcKitTestStaticBranchEliminationLambda0 = [](AbckitFile *file, Abckit
} // namespace
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTest : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS2, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestStaticBranchElimination)
TEST_F(AbckitScenarioTest, LibAbcKitTestStaticBranchElimination)
{
auto output =
helpers::ExecuteStaticAbc(ABCKIT_ABC_DIR "scenarios/static_branch_elimination/static_branch_elimination.abc",

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Before AOP:
class MyClass {
handle() {
@ -24,21 +23,6 @@ class MyClass {
}
}
// After AOP:
// class MyClass {
// handle() {
// print('file: har_A/src/MyClass, function: MyClass.handle')
// let t1 = Date.getTime()
// // business logic
// let t2 = Date.getTime()
// print('Ellapsed time:')
// print(t2 - t1)
// }
// }
function main() {
let c = new MyClass();
c.handle();

View File

@ -34,25 +34,57 @@ auto g_dynG = AbckitGetIsaApiDynamicImpl(ABCKIT_VERSION_RELEASE_1_0_0);
using CB = std::function<void(AbckitCoreFunction *)>;
void EnumerateAllMethods(AbckitFile *file, const CB &cbUserFunc)
void EnumerateAllMethodsInModule(AbckitFile *file, std::function<void(AbckitCoreNamespace *)> &cbNamespace,
std::function<void(AbckitCoreClass *)> &cbClass,
std::function<void(AbckitCoreFunction *)> &cbFunc)
{
CB cbFunc = [&](AbckitCoreFunction *f) {
cbUserFunc(f);
g_implI->functionEnumerateNestedFunctions(f, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<CB *>(cb))(m);
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->moduleEnumerateClasses(m, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->moduleEnumerateTopLevelFunctions(m, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreClass *)> cbClass = [&](AbckitCoreClass *c) {
g_implI->fileEnumerateModules(file, &cbModule, [](AbckitCoreModule *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreModule *)> *>(cb))(m);
return true;
});
}
void EnumerateAllMethods(AbckitFile *file, const CB &cbUserFunc)
{
CB cbFunc;
std::function<void(AbckitCoreClass *)> cbClass;
cbFunc = [&](AbckitCoreFunction *f) {
cbUserFunc(f);
g_implI->functionEnumerateNestedFunctions(f, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
(*reinterpret_cast<CB *>(cb))(f);
return true;
});
g_implI->functionEnumerateNestedClasses(f, (void *)&cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
};
cbClass = [&](AbckitCoreClass *c) {
g_implI->classEnumerateMethods(c, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<CB *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreNamespace *)> cbNamespce = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
std::function<void(AbckitCoreNamespace *)> cbNamespace = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
@ -66,32 +98,14 @@ void EnumerateAllMethods(AbckitFile *file, const CB &cbUserFunc)
});
};
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespce, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->moduleEnumerateClasses(m, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->moduleEnumerateTopLevelFunctions(m, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<CB *>(cb))(m);
return true;
});
};
g_implI->fileEnumerateModules(file, &cbModule, [](AbckitCoreModule *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreModule *)> *>(cb))(m);
return true;
});
EnumerateAllMethodsInModule(file, cbNamespace, cbClass, cbFunc);
}
} // namespace
namespace libabckit::test {
class LibAbcKitTest : public ::testing::Test {};
class AbckitScenarioTestClean : public ::testing::Test {};
struct UserData {
AbckitString *print = nullptr;
@ -161,10 +175,22 @@ static void CreateEpilog(AbckitInst *inst, AbckitBasicBlock *bb, UserData *userD
}
}
std::vector<AbckitBasicBlock *> BBgetSuccBlocks(AbckitBasicBlock *bb)
{
std::vector<AbckitBasicBlock *> succBBs;
g_implG->bbVisitSuccBlocks(
bb, (void *)&succBBs,
[]([[maybe_unused]] AbckitBasicBlock *curBasicBlock, AbckitBasicBlock *succBasicBlock, void *d) {
auto *succs = reinterpret_cast<std::vector<AbckitBasicBlock *> *>(d);
succs->emplace_back(succBasicBlock);
});
return succBBs;
}
static void TransformIr(AbckitGraph *graph, UserData *userData)
{
AbckitBasicBlock *startBB = g_implG->gGetStartBasicBlock(graph);
std::vector<AbckitBasicBlock *> succBBs = helpers::BBgetSuccBlocks(startBB);
std::vector<AbckitBasicBlock *> succBBs = BBgetSuccBlocks(startBB);
auto *bb = succBBs[0];
// Prolog
@ -220,13 +246,13 @@ static std::string GetMethodName(AbckitCoreFunction *method)
// CC-OFFNXT(huge_method, C_RULE_ID_FUNCTION_SIZE) test, solid logic
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(LibAbcKitTest, LibAbcKitTestDynamicAddLogClean)
TEST_F(AbckitScenarioTestClean, LibAbcKitTestDynamicAddLogClean)
{
// ExecuteDynamicAbc is helper function needed for testing. Вoes not affect the logic of IR transformation
auto output = helpers::ExecuteDynamicAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/add_log_js/add_log_dynamic.abc",
auto output = helpers::ExecuteDynamicAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_log/add_log_dynamic.abc",
"add_log_dynamic");
EXPECT_TRUE(helpers::Match(output, "abckit\n"));
AbckitFile *file = g_impl->openAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/add_log_js/add_log_dynamic.abc");
AbckitFile *file = g_impl->openAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_log/add_log_dynamic.abc");
UserData data = {};
data.print = g_implM->createString(file, "print");
data.date = g_implM->createString(file, "Date");
@ -245,11 +271,11 @@ TEST_F(LibAbcKitTest, LibAbcKitTestDynamicAddLogClean)
AbckitGraph *graph = g_implI->createGraphFromFunction(handleMethod);
TransformIr(graph, &data);
g_implM->functionSetGraph(handleMethod, graph);
g_impl->writeAbc(file, ABCKIT_ABC_DIR "scenarios_c_api_clean/add_log_js/add_log_dynamic_modified.abc");
g_impl->writeAbc(file, ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_log/add_log_dynamic_modified.abc");
g_impl->closeFile(file);
output = helpers::ExecuteDynamicAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/add_log_js/add_log_dynamic_modified.abc",
"add_log_dynamic");
output = helpers::ExecuteDynamicAbc(
ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_log/add_log_dynamic_modified.abc", "add_log_dynamic");
EXPECT_TRUE(helpers::Match(output,
"file: src/MyClass, function: MyClass.handle\n"
"abckit\n"

View File

@ -0,0 +1,34 @@
/**
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function throwableAPI() {
print('THROW');
throw new Error('DUMMY_ERROR');
}
class Handler {
run() {
let tmp;
tmp = throwableAPI();
return tmp;
}
}
function main() {
let c = new Handler();
print(c.run());
}
main();

View File

@ -0,0 +1,210 @@
/**
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "libabckit/include/c/abckit.h"
#include "adapter_static/ir_static.h"
#include "libabckit/include/c/metadata_core.h"
#include "libabckit/include/c/ir_core.h"
#include "libabckit/include/c/isa/isa_dynamic.h"
#include "helpers/helpers.h"
#include "helpers/helpers_runtime.h"
#include <gtest/gtest.h>
namespace {
auto g_impl = AbckitGetApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
auto g_implI = AbckitGetInspectApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
auto g_implM = AbckitGetModifyApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
auto g_implG = AbckitGetGraphApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
auto g_dynG = AbckitGetIsaApiDynamicImpl(ABCKIT_VERSION_RELEASE_1_0_0);
using CB = std::function<void(AbckitCoreFunction *)>;
void EnumerateAllMethodsInModule(AbckitFile *file, std::function<void(AbckitCoreNamespace *)> &cbNamespace,
std::function<void(AbckitCoreClass *)> &cbClass,
std::function<void(AbckitCoreFunction *)> &cbFunc)
{
std::function<void(AbckitCoreModule *)> cbModule = [&](AbckitCoreModule *m) {
g_implI->moduleEnumerateNamespaces(m, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->moduleEnumerateClasses(m, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->moduleEnumerateTopLevelFunctions(m, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreFunction *)> *>(cb))(m);
return true;
});
};
g_implI->fileEnumerateModules(file, &cbModule, [](AbckitCoreModule *m, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreModule *)> *>(cb))(m);
return true;
});
}
void EnumerateAllMethods(AbckitFile *file, const CB &cbUserFunc)
{
CB cbFunc = [&](AbckitCoreFunction *f) {
cbUserFunc(f);
g_implI->functionEnumerateNestedFunctions(f, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<CB *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreClass *)> cbClass = [&](AbckitCoreClass *c) {
g_implI->classEnumerateMethods(c, (void *)&cbFunc, [](AbckitCoreFunction *m, void *cb) {
(*reinterpret_cast<CB *>(cb))(m);
return true;
});
};
std::function<void(AbckitCoreNamespace *)> cbNamespace = [&](AbckitCoreNamespace *n) {
g_implI->namespaceEnumerateNamespaces(n, &cbNamespace, [](AbckitCoreNamespace *n, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreNamespace *)> *>(cb))(n);
return true;
});
g_implI->namespaceEnumerateClasses(n, &cbClass, [](AbckitCoreClass *c, void *cb) {
(*reinterpret_cast<std::function<void(AbckitCoreClass *)> *>(cb))(c);
return true;
});
g_implI->namespaceEnumerateTopLevelFunctions(n, (void *)&cbFunc, [](AbckitCoreFunction *f, void *cb) {
(*reinterpret_cast<CB *>(cb))(f);
return true;
});
};
EnumerateAllMethodsInModule(file, cbNamespace, cbClass, cbFunc);
}
std::string GetMethodName(AbckitCoreFunction *method)
{
auto mname = g_implI->functionGetName(method);
std::string fullSig = g_implI->abckitStringToString(mname);
auto fullName = fullSig.substr(0, fullSig.find(':'));
return fullName;
}
struct UserData {
AbckitString *print = nullptr;
};
std::vector<AbckitBasicBlock *> BBgetPredBlocks(AbckitBasicBlock *bb)
{
std::vector<AbckitBasicBlock *> predBBs;
g_implG->bbVisitPredBlocks(
bb, (void *)&predBBs,
[]([[maybe_unused]] AbckitBasicBlock *curBasicBlock, AbckitBasicBlock *succBasicBlock, void *d) {
auto *preds = reinterpret_cast<std::vector<AbckitBasicBlock *> *>(d);
preds->emplace_back(succBasicBlock);
});
return predBBs;
}
std::vector<AbckitBasicBlock *> BBgetSuccBlocks(AbckitBasicBlock *bb)
{
std::vector<AbckitBasicBlock *> succBBs;
g_implG->bbVisitSuccBlocks(
bb, (void *)&succBBs,
[]([[maybe_unused]] AbckitBasicBlock *curBasicBlock, AbckitBasicBlock *succBasicBlock, void *d) {
auto *succs = reinterpret_cast<std::vector<AbckitBasicBlock *> *>(d);
succs->emplace_back(succBasicBlock);
});
return succBBs;
}
void TransformIr(AbckitGraph *graph, UserData *userData)
{
AbckitBasicBlock *startBB = g_implG->gGetStartBasicBlock(graph);
AbckitBasicBlock *endBB = g_implG->gGetEndBasicBlock(graph);
std::vector<AbckitBasicBlock *> succBBs = BBgetSuccBlocks(startBB);
AbckitBasicBlock *bb = succBBs[0];
AbckitInst *initInst = g_implG->bbGetFirstInst(bb);
AbckitInst *prevRetInst = g_implG->iGetPrev(g_implG->bbGetLastInst(bb));
AbckitBasicBlock *tryBegin = g_implG->bbSplitBlockAfterInstruction(initInst, true);
AbckitBasicBlock *tryEnd = g_implG->bbSplitBlockAfterInstruction(prevRetInst, true);
// Fill catchBlock
AbckitBasicBlock *catchBlock = g_implG->bbCreateEmpty(graph);
AbckitInst *catchPhi = g_implG->bbCreateCatchPhi(catchBlock, 0);
AbckitInst *print = g_dynG->iCreateTryldglobalbyname(graph, userData->print);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
g_implG->bbAddInstBack(catchBlock, print);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
AbckitInst *callArg = g_dynG->iCreateCallarg1(graph, print, catchPhi);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
g_implG->bbAddInstBack(catchBlock, callArg);
AbckitBasicBlock *epilogueBB = BBgetPredBlocks(endBB)[0];
AbckitInst *retInst = g_implG->bbGetLastInst(epilogueBB);
AbckitInst *firstPhiInput = g_implG->iGetInput(retInst, 0);
AbckitInst *secondPhiInput = g_dynG->iCreateLdfalse(graph);
g_implG->bbAddInstBack(bb, secondPhiInput);
AbckitInst *phiInst = g_implG->bbCreatePhi(epilogueBB, 2, firstPhiInput, secondPhiInput);
g_implG->iSetInput(retInst, phiInst, 0);
g_implG->gInsertTryCatch(tryBegin, tryEnd, catchBlock, catchBlock);
}
} // namespace
namespace libabckit::test {
class AbckitScenarioTestClean : public ::testing::Test {};
// Test: test-kind=scenario, abc-kind=ArkTS1, category=positive
TEST_F(AbckitScenarioTestClean, LibAbcKitTestDynamicAddTryCatchClean)
{
auto output = helpers::ExecuteDynamicAbc(
ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch.abc", "add_try_catch");
EXPECT_TRUE(helpers::Match(output, "THROW\n"));
AbckitFile *file = g_impl->openAbc(ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch.abc");
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
AbckitCoreFunction *runMethod;
EnumerateAllMethods(file, [&](AbckitCoreFunction *method) {
auto methodName = GetMethodName(method);
if (methodName == "run") {
runMethod = method;
}
});
AbckitGraph *graph = g_implI->createGraphFromFunction(runMethod);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
UserData uData {};
uData.print = g_implM->createString(file, "print");
TransformIr(graph, &uData);
g_implM->functionSetGraph(runMethod, graph);
g_impl->writeAbc(file, ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch_modified.abc");
g_impl->closeFile(file);
ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
output = helpers::ExecuteDynamicAbc(
ABCKIT_ABC_DIR "scenarios_c_api_clean/dynamic/add_try_catch/add_try_catch_modified.abc", "add_try_catch");
EXPECT_TRUE(helpers::Match(output,
"THROW\n"
"Error: DUMMY_ERROR\n"
"false\n"));
}
} // namespace libabckit::test

View File

@ -0,0 +1,72 @@
/**
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
ApiNamespace
} from './modules/apiNamespace';
import {
bar
} from './modules/toplevelApi';
import {
geolocation
} from '@ohos.geolocation';
class Person {
personUseFoo() {
ApiNamespace.foo();
}
personUseBar() {
bar();
}
personUseClass() {
return new ApiNamespace.MyClass();
}
personUseAll() {
ApiNamespace.foo();
bar();
return new ApiNamespace.MyClass();
}
personUseLocation() {
geolocation.getCurrentLocation();
}
personUseOther() {
geolocation.getLastLocation();
}
personNoUse() {}
}
function useFoo() {
ApiNamespace.foo();
}
function useBar() {
bar();
}
function useClass() {
return new ApiNamespace.MyClass();
}
function useLocation() {
geolocation.getCurrentLocation();
}
function useAll() {
ApiNamespace.foo();
bar();
geolocation.getCurrentLocation();
return new ApiNamespace.MyClass();
}
function noUse() {}

Some files were not shown because too many files have changed in this diff Show More