Skip to content

Commit

Permalink
astutils.cpp: always inline isMutableExpression() with Clang (#6647)
Browse files Browse the repository at this point in the history
The function is too big to automatically be inlined. By forcing the
inlining we mainly save the overhead associated with calling the
function.
  • Loading branch information
firewave committed Aug 7, 2024
1 parent cf3373d commit b40f41b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,14 @@ static bool isArray(const Token* tok)
return false;
}

static bool isMutableExpression(const Token* tok)
static inline
// limit it to CLang as compiling with GCC might fail with
// error: inlining failed in call to always_inline 'bool isMutableExpression(const Token*)': function not considered for inlining
// error: inlining failed in call to ‘always_inline’ ‘bool isMutableExpression(const Token*)’: recursive inlining
#if defined(__clang__)
__attribute__((always_inline))
#endif
bool isMutableExpression(const Token* tok)
{
if (!tok)
return false;
Expand Down

0 comments on commit b40f41b

Please sign in to comment.