Merge remote-tracking branch 'origin/master' into runtime_compile_v5

This commit is contained in:
Ivan 2017-10-14 12:28:32 +03:00
commit dc78564bf4
148 changed files with 6682 additions and 4967 deletions

View file

@ -297,7 +297,7 @@ void DtoGoto(Loc &loc, LabelDsymbol *target) {
LabelStatement *lblstmt = target->statement;
if (!lblstmt) {
error(loc, "the label %s does not exist", target->ident->toChars());
error(loc, "the label `%s` does not exist", target->ident->toChars());
fatal();
}
@ -413,7 +413,7 @@ DValue *DtoNullValue(Type *type, Loc loc) {
LLValue *ptr = getNullPtr(DtoPtrToType(basetype->nextOf()));
return new DSliceValue(type, len, ptr);
}
error(loc, "null not known for type '%s'", type->toChars());
error(loc, "`null` not known for type `%s`", type->toChars());
fatal();
}
@ -464,7 +464,7 @@ DValue *DtoCastInt(Loc &loc, DValue *val, Type *_to) {
IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n';
rval = gIR->ir->CreateIntToPtr(rval, tolltype);
} else {
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
_to->toChars());
fatal();
}
@ -496,7 +496,7 @@ DValue *DtoCastPtr(Loc &loc, DValue *val, Type *to) {
} else if (totype->isintegral()) {
rval = new llvm::PtrToIntInst(DtoRVal(val), tolltype, "", gIR->scopebb());
} else {
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -535,7 +535,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) {
} else if (fromsz > tosz) {
rval = new llvm::FPTruncInst(DtoRVal(val), tolltype, "", gIR->scopebb());
} else {
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -546,7 +546,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) {
rval = new llvm::FPToSIInst(DtoRVal(val), tolltype, "", gIR->scopebb());
}
} else {
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -562,7 +562,7 @@ DValue *DtoCastDelegate(Loc &loc, DValue *val, Type *to) {
return new DImValue(to,
DtoDelegateEquals(TOKnotequal, DtoRVal(val), nullptr));
}
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -594,7 +594,7 @@ DValue *DtoCastVector(Loc &loc, DValue *val, Type *to) {
if (totype->ty == Tvector && to->size() == val->type->size()) {
return new DImValue(to, DtoBitCast(DtoRVal(val), tolltype));
}
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -611,7 +611,7 @@ DValue *DtoCastStruct(Loc &loc, DValue *val, Type *to) {
return new DLValue(to, result);
}
error(loc, "Internal Compiler Error: Invalid struct cast from '%s' to '%s'",
error(loc, "Internal Compiler Error: Invalid struct cast from `%s` to `%s`",
val->type->toChars(), to->toChars());
fatal();
}
@ -680,7 +680,7 @@ DValue *DtoCast(Loc &loc, DValue *val, Type *to) {
}
// fall-through
default:
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
to->toChars());
fatal();
}
@ -835,7 +835,7 @@ void DtoResolveVariable(VarDeclaration *vd) {
if (gIR->dmodule) {
vd->ir->setInitialized();
}
std::string llName(getMangledName(vd));
const auto irMangle = getIRMangledName(vd);
// Since the type of a global must exactly match the type of its
// initializer, we cannot know the type until after we have emitted the
@ -856,8 +856,8 @@ void DtoResolveVariable(VarDeclaration *vd) {
llvm::GlobalVariable *gvar =
getOrCreateGlobal(vd->loc, gIR->module, DtoMemType(vd->type), isLLConst,
linkage, nullptr, llName, vd->isThreadlocal());
IrGlobal *varIr = getIrGlobal(vd);
linkage, nullptr, irMangle, vd->isThreadlocal());
auto varIr = getIrGlobal(vd);
varIr->value = gvar;
// Set the alignment (it is important not to use type->alignsize because
@ -1248,7 +1248,8 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti,
char prefix = T->isreal() ? 'f' : T->isintegral() ? 'i' : 0;
if (!prefix) {
ti->error("has invalid template parameter for intrinsic: %s", T->toChars());
ti->error("has invalid template parameter for intrinsic: `%s`",
T->toChars());
fatal(); // or LLVM asserts
}
@ -1274,13 +1275,13 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti,
} else {
if (pos && (name[pos - 1] == 'i' || name[pos - 1] == 'f')) {
// Wrong type character.
ti->error(
"has invalid parameter type for intrinsic %s: %s is not a%s type",
name.c_str(), T->toChars(),
(name[pos - 1] == 'i' ? "n integral" : " floating-point"));
ti->error("has invalid parameter type for intrinsic `%s`: `%s` is not "
"a%s type",
name.c_str(), T->toChars(),
(name[pos - 1] == 'i' ? "n integral" : " floating-point"));
} else {
// Just plain wrong. (Error in declaration, not instantiation)
td->error("has an invalid intrinsic name: %s", name.c_str());
td->error("has an invalid intrinsic name: `%s`", name.c_str());
}
fatal(); // or LLVM asserts
}
@ -1362,7 +1363,7 @@ void callPostblit(Loc &loc, Expression *exp, LLValue *val) {
FuncDeclaration *fd = sd->postblit;
if (fd->storage_class & STCdisable) {
fd->toParent()->error(
loc, "is not copyable because it is annotated with @disable");
loc, "is not copyable because it is annotated with `@disable`");
}
DtoResolveFunction(fd);
Expressions args;
@ -1487,7 +1488,7 @@ DValue *DtoSymbolAddress(Loc &loc, Type *type, Declaration *decl) {
// this is an error! must be accessed with DotVarExp
if (vd->needThis()) {
error(loc, "need 'this' to access member %s", vd->toChars());
error(loc, "need `this` to access member `%s`", vd->toChars());
fatal();
}
@ -1617,7 +1618,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) {
// TODO: This check really does not belong here, should be moved to
// semantic analysis in the frontend.
if (decl->needThis()) {
error(loc, "need 'this' to access %s", decl->toChars());
error(loc, "need `this` to access `%s`", decl->toChars());
fatal();
}
@ -1629,7 +1630,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) {
// AssocArrayLiteralExp::toElem, which requires on error
// gagging to check for constantness of the initializer.
error(loc,
"cannot use address of non-global variable '%s' as constant "
"cannot use address of non-global variable `%s` as constant "
"initializer",
vd->toChars());
if (!global.gag) {
@ -1699,7 +1700,7 @@ llvm::GlobalVariable *getOrCreateGlobal(const Loc &loc, llvm::Module &module,
if (existing->getType()->getElementType() != type) {
error(loc,
"Global variable type does not match previous declaration with "
"same mangled name: %s",
"same mangled name: `%s`",
name.str().c_str());
fatal();
}