mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Skip unittests in imported modules
This commit is contained in:
parent
7070239e7d
commit
6bc2431b6b
7 changed files with 12 additions and 1 deletions
|
@ -156,6 +156,7 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen
|
|||
moduleInfoType = new llvm::PATypeHolder(llvm::OpaqueType::get(llvm::getGlobalContext()));
|
||||
this->doDocComment = doDocComment;
|
||||
this->doHdrGen = doHdrGen;
|
||||
this->isRoot = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -206,6 +206,8 @@ struct Module : Package
|
|||
|
||||
// array ops emitted in this module already
|
||||
StringTable arrayfuncs;
|
||||
|
||||
bool isRoot;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -3700,7 +3700,11 @@ Dsymbol *UnitTestDeclaration::syntaxCopy(Dsymbol *s)
|
|||
|
||||
void UnitTestDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
#if IN_LLVM
|
||||
if (global.params.useUnitTests && sc->module->isRoot)
|
||||
#else
|
||||
if (global.params.useUnitTests)
|
||||
#endif
|
||||
{
|
||||
if (!type)
|
||||
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
|
||||
|
|
|
@ -218,6 +218,7 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen
|
|||
moduleInfoType = new llvm::PATypeHolder(llvm::OpaqueType::get(llvm::getGlobalContext()));
|
||||
this->doDocComment = doDocComment;
|
||||
this->doHdrGen = doHdrGen;
|
||||
this->isRoot = false;
|
||||
#endif
|
||||
}
|
||||
#if IN_LLVM
|
||||
|
|
|
@ -214,6 +214,8 @@ struct Module : Package
|
|||
|
||||
// array ops emitted in this module already
|
||||
StringTable arrayfuncs;
|
||||
|
||||
bool isRoot;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ static llvm::Function* DtoDeclareVaFunction(FuncDeclaration* fdecl)
|
|||
|
||||
void DtoResolveFunction(FuncDeclaration* fdecl)
|
||||
{
|
||||
if (!global.params.useUnitTests && fdecl->isUnitTestDeclaration()) {
|
||||
if ((!global.params.useUnitTests || !fdecl->type) && fdecl->isUnitTestDeclaration()) {
|
||||
Logger::println("Ignoring unittest %s", fdecl->toPrettyChars());
|
||||
return; // ignore declaration completely
|
||||
}
|
||||
|
|
|
@ -780,6 +780,7 @@ LDC_TARGETS
|
|||
|
||||
id = Lexer::idPool(name);
|
||||
m = new Module((char *) files.data[i], id, global.params.doDocComments, global.params.doHdrGeneration);
|
||||
m->isRoot = true;
|
||||
modules.push(m);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue