Ai
21 Star 49 Fork 0

Gitee 极速下载/julia-language

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/JuliaLang/julia
克隆/下载
GCPushPop.cpp 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
Zentrik 提交于 2025-05-14 19:40 +08:00 . Bump LLVM to v20 (#58142)
// This file is a part of Julia. License is MIT: https://julialang.org/license
// RUN: clang -D__clang_gcanalyzer__ --analyze -Xanalyzer -analyzer-output=text -Xclang -load -Xclang libGCCheckerPlugin%shlibext -Xclang -verify -I%julia_home/src -I%julia_home/src/support -I%julia_home/usr/include ${CLANGSA_FLAGS} ${CLANGSA_CXXFLAGS} ${CPPFLAGS} ${CFLAGS} -Xclang -analyzer-checker=core,julia.GCChecker --analyzer-no-default-checks -x c++ %s
#include "julia.h"
#include <string>
void missingPop() {
jl_value_t *x = NULL;
JL_GC_PUSH1(&x); // expected-note{{GC frame changed here}}
} // expected-warning@-1{{Non-popped GC frame present at end of function}}
// expected-note@-2{{Non-popped GC frame present at end of function}}
void missingPop2() {
jl_value_t **x;
JL_GC_PUSHARGS(x, 2); // expected-note{{GC frame changed here}}
} // expected-warning@-1{{Non-popped GC frame present at end of function}}
// expected-note@-2{{Non-popped GC frame present at end of function}}
void superfluousPop() {
JL_GC_POP(); // expected-warning{{JL_GC_POP without corresponding push}}
} // expected-note@-1{{JL_GC_POP without corresponding push}}
// From gc.c, jl_gc_push_arraylist creates a custom stack frame.
extern void jl_gc_push_arraylist(jl_ptls_t ptls, arraylist_t *list);
extern void run_finalizer(jl_ptls_t ptls, jl_value_t *o, jl_value_t *ff);
void jl_gc_run_finalizers_in_list(jl_ptls_t ptls, arraylist_t *list)
{
size_t len = list->len;
jl_value_t **items = (jl_value_t**)list->items;
jl_gc_push_arraylist(ptls, list);
(void)len; (void)items;
//for (size_t i = 2;i < len;i += 2)
// run_finalizer(ptls, items[i], items[i + 1]);
JL_GC_POP();
}
bool testfunc1() JL_NOTSAFEPOINT
{
struct implied_struct1 { // expected-note{{Tried to call method defined here}}
std::string s;
struct implied_constructor { } x;
} x; // expected-warning{{Calling potential safepoint as CXXConstructorCall from function annotated JL_NOTSAFEPOINT}}
// expected-note@-1{{Calling potential safepoint as CXXConstructorCall from function annotated JL_NOTSAFEPOINT}}
return 1;
}
bool testfunc2() JL_NOTSAFEPOINT
{
struct implied_struct2 { // expected-note{{Tried to call method defined here}}
std::string s;
} x{""};
return 1; // expected-warning{{Calling potential safepoint as CXXDestructorCall from function annotated JL_NOTSAFEPOINT}}
// expected-note@-1{{Calling potential safepoint as CXXDestructorCall from function annotated JL_NOTSAFEPOINT}}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/mirrors/julia-language.git
git@gitee.com:mirrors/julia-language.git
mirrors
julia-language
julia-language
master

搜索帮助