mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-03 11:03:14 +01:00
Don't set TypePointer::isunsigned to true in the frontend.
The previous solution was problematic because the change was language- visble via the isUnsigned trait. Now, pointers are simply explicitly checked for in the relevant places. (Note that there might be cases in the diff where a direct isunsigned() call would have been appropriate – I only checked for instances where the type clearly cannot be a pointer, but chose to go the safe route in replicating existing behavior otherwise). Fixes DMD testcase 'traits'.
This commit is contained in:
@@ -593,7 +593,7 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
|
||||
if (fromsz < tosz || from->ty == Tbool) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast to: " << *tolltype << '\n';
|
||||
if (from->isunsigned() || from->ty == Tbool) {
|
||||
if (isLLVMUnsigned(from) || from->ty == Tbool) {
|
||||
rval = new llvm::ZExtInst(rval, tolltype, "tmp", gIR->scopebb());
|
||||
} else {
|
||||
rval = new llvm::SExtInst(rval, tolltype, "tmp", gIR->scopebb());
|
||||
@@ -1844,6 +1844,13 @@ bool isSpecialRefVar(VarDeclaration* vd)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool isLLVMUnsigned(Type* t)
|
||||
{
|
||||
return t->isunsigned() || t->ty == Tpointer;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void printLabelName(std::ostream& target, const char* func_mangle, const char* label_name)
|
||||
{
|
||||
target << gTargetMachine->getMCAsmInfo()->getPrivateGlobalPrefix() <<
|
||||
|
||||
Reference in New Issue
Block a user