Skip to content

Commit 7480f14

Browse files
committed
Implement robust is_intrinsic_function()
1 parent ed7caec commit 7480f14

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libasr/asr_utils.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,18 @@ static inline bool is_intrinsic_function(const ASR::Function_t *fn) {
368368
return false;
369369
}
370370

371+
// Returns true if the Function is intrinsic, otherwise false
372+
// This version uses the `intrinsic` member of `Module`, so it
373+
// should be used instead of is_intrinsic_function
374+
static inline bool is_intrinsic_function2(const ASR::Function_t *fn) {
375+
ASR::symbol_t *sym = (ASR::symbol_t*)fn;
376+
ASR::Module_t *m = get_sym_module0(sym);
377+
if (m != nullptr) {
378+
if (m->m_intrinsic) return true;
379+
}
380+
return false;
381+
}
382+
371383
// Returns true if all arguments have a `value`
372384
static inline bool all_args_have_value(const Vec<ASR::expr_t*> &args) {
373385
for (auto &a : args) {

0 commit comments

Comments
 (0)