Added '-Hkeep-all-bodies' switch.

The same behavior is triggered by the '-inline' switch for
DMD, but this doesn't quite translate to LDC.
This commit is contained in:
David Nadlinger
2013-03-16 11:52:19 +01:00
parent 82ba7fe548
commit 32eb24eebf
4 changed files with 28 additions and 3 deletions

View File

@@ -1948,7 +1948,13 @@ void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
bodyToCBuffer(buf, hgs);
hgs->autoMember--;
}
else if(hgs->tpltMember == 0 && global.params.useInline == 0)
else if(hgs->tpltMember == 0 &&
#if IN_LLVM
!global.params.hdrKeepAllBodies
#else
global.params.useInline == 0
#endif
)
buf->writestring(";");
else
bodyToCBuffer(buf, hgs);
@@ -2022,7 +2028,13 @@ int FuncDeclaration::equals(Object *o)
void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (fbody && (!hgs->hdrgen || global.params.useInline || hgs->autoMember || hgs->tpltMember))
if (fbody && (!hgs->hdrgen ||
#if IN_LLVM
global.params.hdrKeepAllBodies ||
#else
global.params.useInline ||
#endif
hgs->autoMember || hgs->tpltMember))
{
int savetlpt = hgs->tpltMember;
int saveauto = hgs->autoMember;

View File

@@ -282,6 +282,11 @@ struct Param
char *exefile;
char *mapfile;
#if IN_LLVM
// Whether to keep all function bodies in .di file generation or to strip
// those of plain functions. For DMD, this is govenered by the -inline
// flag, which does not directly translate to LDC.
bool hdrKeepAllBodies;
// LDC stuff
OUTPUTFLAG output_ll;
OUTPUTFLAG output_bc;