Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Handle pragma(inline) attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jan 29, 2018
1 parent 28b42cf commit b030191
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
(build_closure): Don't set chain field for functions without context
pointer.

2018-01-21 Iain Buclaw <[email protected]>

* decls.cc (get_symbol_decl): Handle pragma(inline) attributes.

2018-01-21 Iain Buclaw <[email protected]>

* decl.cc (DeclVisitor::visit(StructDeclaration)): Mark compiler
Expand Down
22 changes: 20 additions & 2 deletions gcc/d/decl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,16 @@ get_symbol_decl (Declaration *decl)
d_keep (newfntype);
}

/* Miscellaneous function flags. */
if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
/* In [pragma/inline], The attribute pragma(inline) affects whether a
function should be inlined or not. */
if (fd->inlining == PINLINEnever)
DECL_UNINLINABLE (decl->csym) = 1;
else if (fd->inlining == PINLINEalways)
{
DECL_DECLARED_INLINE_P (decl->csym) = 1;
DECL_DISREGARD_INLINE_LIMITS (decl->csym) = 1;
}
else if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
{
/* See grokmethod in cp/decl.c. Maybe we shouldn't be setting inline
flags without reason or proper handling. */
Expand Down Expand Up @@ -1240,6 +1248,16 @@ get_symbol_decl (Declaration *decl)
else
DECL_EXTERNAL (decl->csym) = 1;
}

/* Don't keep functions declared pragma(inline, true) unless
the user wants us to keep all inline functions. */
if (fd && fd->inlining == PINLINEalways && TREE_PUBLIC (decl->csym))
{
if (flag_keep_inline_functions)
mark_needed (decl->csym);

d_comdat_linkage (decl->csym) = 1;
}
}

/* Symbol is going in thread local storage. */
Expand Down

0 comments on commit b030191

Please sign in to comment.