Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When accessing the data pointer for an array, first decay it to a Derived Pointer #54335

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make the analyzer happier
  • Loading branch information
gbaraldi committed May 3, 2024
commit 70f6990273b50f28aa20a1b9f3544244088b8b9c
89 changes: 43 additions & 46 deletions src/clangsa/GCChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,57 +795,54 @@ static bool isMutexUnlock(StringRef name) {
false;
}

#if LLVM_VERSION_MAJOR >= 13
#define endswith_lower endswith_insensitive
#endif

bool GCChecker::isGCTrackedType(QualType QT) {
return isJuliaType(
[](StringRef Name) {
if (Name.endswith_lower("jl_value_t") ||
Name.endswith_lower("jl_svec_t") ||
Name.endswith_lower("jl_sym_t") ||
Name.endswith_lower("jl_expr_t") ||
Name.endswith_lower("jl_code_info_t") ||
Name.endswith_lower("jl_array_t") ||
Name.endswith_lower("jl_genericmemory_t") ||
//Name.endswith_lower("jl_genericmemoryref_t") ||
Name.endswith_lower("jl_method_t") ||
Name.endswith_lower("jl_method_instance_t") ||
Name.endswith_lower("jl_debuginfo_t") ||
Name.endswith_lower("jl_tupletype_t") ||
Name.endswith_lower("jl_datatype_t") ||
Name.endswith_lower("jl_typemap_entry_t") ||
Name.endswith_lower("jl_typemap_level_t") ||
Name.endswith_lower("jl_typename_t") ||
Name.endswith_lower("jl_module_t") ||
Name.endswith_lower("jl_tupletype_t") ||
Name.endswith_lower("jl_gc_tracked_buffer_t") ||
Name.endswith_lower("jl_binding_t") ||
Name.endswith_lower("jl_ordereddict_t") ||
Name.endswith_lower("jl_tvar_t") ||
Name.endswith_lower("jl_typemap_t") ||
Name.endswith_lower("jl_unionall_t") ||
Name.endswith_lower("jl_methtable_t") ||
Name.endswith_lower("jl_cgval_t") ||
Name.endswith_lower("jl_codectx_t") ||
Name.endswith_lower("jl_ast_context_t") ||
Name.endswith_lower("jl_code_instance_t") ||
Name.endswith_lower("jl_excstack_t") ||
Name.endswith_lower("jl_task_t") ||
Name.endswith_lower("jl_uniontype_t") ||
Name.endswith_lower("jl_method_match_t") ||
Name.endswith_lower("jl_vararg_t") ||
Name.endswith_lower("jl_opaque_closure_t") ||
Name.endswith_lower("jl_globalref_t") ||
if (Name.ends_with_insensitive("jl_value_t") ||
Name.ends_with_insensitive("jl_svec_t") ||
Name.ends_with_insensitive("jl_sym_t") ||
Name.ends_with_insensitive("jl_expr_t") ||
Name.ends_with_insensitive("jl_code_info_t") ||
Name.ends_with_insensitive("jl_array_t") ||
Name.ends_with_insensitive("jl_genericmemory_t") ||
//Name.ends_with_insensitive("jl_genericmemoryref_t") ||
Name.ends_with_insensitive("jl_method_t") ||
Name.ends_with_insensitive("jl_method_instance_t") ||
Name.ends_with_insensitive("jl_debuginfo_t") ||
Name.ends_with_insensitive("jl_tupletype_t") ||
Name.ends_with_insensitive("jl_datatype_t") ||
Name.ends_with_insensitive("jl_typemap_entry_t") ||
Name.ends_with_insensitive("jl_typemap_level_t") ||
Name.ends_with_insensitive("jl_typename_t") ||
Name.ends_with_insensitive("jl_module_t") ||
Name.ends_with_insensitive("jl_tupletype_t") ||
Name.ends_with_insensitive("jl_gc_tracked_buffer_t") ||
Name.ends_with_insensitive("jl_binding_t") ||
Name.ends_with_insensitive("jl_ordereddict_t") ||
Name.ends_with_insensitive("jl_tvar_t") ||
Name.ends_with_insensitive("jl_typemap_t") ||
Name.ends_with_insensitive("jl_unionall_t") ||
Name.ends_with_insensitive("jl_methtable_t") ||
Name.ends_with_insensitive("jl_cgval_t") ||
Name.ends_with_insensitive("jl_codectx_t") ||
Name.ends_with_insensitive("jl_ast_context_t") ||
Name.ends_with_insensitive("jl_code_instance_t") ||
Name.ends_with_insensitive("jl_excstack_t") ||
Name.ends_with_insensitive("jl_task_t") ||
Name.ends_with_insensitive("jl_uniontype_t") ||
Name.ends_with_insensitive("jl_method_match_t") ||
Name.ends_with_insensitive("jl_vararg_t") ||
Name.ends_with_insensitive("jl_opaque_closure_t") ||
Name.ends_with_insensitive("jl_globalref_t") ||
// Probably not technically true for these, but let's allow it
Name.endswith_lower("typemap_intersection_env") ||
Name.endswith_lower("interpreter_state") ||
Name.endswith_lower("jl_typeenv_t") ||
Name.endswith_lower("jl_stenv_t") ||
Name.endswith_lower("jl_varbinding_t") ||
Name.endswith_lower("set_world") ||
Name.endswith_lower("jl_codectx_t")) {
Name.ends_with_insensitive("typemap_intersection_env") ||
Name.ends_with_insensitive("interpreter_state") ||
Name.ends_with_insensitive("jl_typeenv_t") ||
Name.ends_with_insensitive("jl_stenv_t") ||
Name.ends_with_insensitive("jl_varbinding_t") ||
Name.ends_with_insensitive("set_world") ||
Name.ends_with_insensitive("jl_codectx_t")) {
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct RemoveNIPass : PassInfoMixin<RemoveNIPass> {

struct MultiVersioningPass : PassInfoMixin<MultiVersioningPass> {
bool external_use;
MultiVersioningPass(bool external_use = false) : external_use(external_use) {}
MultiVersioningPass(bool external_use = false) JL_NOTSAFEPOINT : external_use(external_use) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) JL_NOTSAFEPOINT;
static bool isRequired() { return true; }
};
Expand Down