mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 17:11:44 +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()));
|
moduleInfoType = new llvm::PATypeHolder(llvm::OpaqueType::get(llvm::getGlobalContext()));
|
||||||
this->doDocComment = doDocComment;
|
this->doDocComment = doDocComment;
|
||||||
this->doHdrGen = doHdrGen;
|
this->doHdrGen = doHdrGen;
|
||||||
|
this->isRoot = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,8 @@ struct Module : Package
|
||||||
|
|
||||||
// array ops emitted in this module already
|
// array ops emitted in this module already
|
||||||
StringTable arrayfuncs;
|
StringTable arrayfuncs;
|
||||||
|
|
||||||
|
bool isRoot;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3700,7 +3700,11 @@ Dsymbol *UnitTestDeclaration::syntaxCopy(Dsymbol *s)
|
||||||
|
|
||||||
void UnitTestDeclaration::semantic(Scope *sc)
|
void UnitTestDeclaration::semantic(Scope *sc)
|
||||||
{
|
{
|
||||||
|
#if IN_LLVM
|
||||||
|
if (global.params.useUnitTests && sc->module->isRoot)
|
||||||
|
#else
|
||||||
if (global.params.useUnitTests)
|
if (global.params.useUnitTests)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!type)
|
if (!type)
|
||||||
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
|
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()));
|
moduleInfoType = new llvm::PATypeHolder(llvm::OpaqueType::get(llvm::getGlobalContext()));
|
||||||
this->doDocComment = doDocComment;
|
this->doDocComment = doDocComment;
|
||||||
this->doHdrGen = doHdrGen;
|
this->doHdrGen = doHdrGen;
|
||||||
|
this->isRoot = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if IN_LLVM
|
#if IN_LLVM
|
||||||
|
|
|
@ -214,6 +214,8 @@ struct Module : Package
|
||||||
|
|
||||||
// array ops emitted in this module already
|
// array ops emitted in this module already
|
||||||
StringTable arrayfuncs;
|
StringTable arrayfuncs;
|
||||||
|
|
||||||
|
bool isRoot;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ static llvm::Function* DtoDeclareVaFunction(FuncDeclaration* fdecl)
|
||||||
|
|
||||||
void DtoResolveFunction(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());
|
Logger::println("Ignoring unittest %s", fdecl->toPrettyChars());
|
||||||
return; // ignore declaration completely
|
return; // ignore declaration completely
|
||||||
}
|
}
|
||||||
|
|
|
@ -780,6 +780,7 @@ LDC_TARGETS
|
||||||
|
|
||||||
id = Lexer::idPool(name);
|
id = Lexer::idPool(name);
|
||||||
m = new Module((char *) files.data[i], id, global.params.doDocComments, global.params.doHdrGeneration);
|
m = new Module((char *) files.data[i], id, global.params.doDocComments, global.params.doHdrGeneration);
|
||||||
|
m->isRoot = true;
|
||||||
modules.push(m);
|
modules.push(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue