Fix C++ backend bug introduced in d14a2de168.
(This was causing a number of tests to fail with the generic targets.)
This commit is contained in:
14
cbackend.cpp
14
cbackend.cpp
@@ -778,6 +778,16 @@ raw_ostream &CWriter::printType(raw_ostream &Out, Type *Ty,
|
|||||||
Out << " return ret;\n";
|
Out << " return ret;\n";
|
||||||
Out << " }\n ";
|
Out << " }\n ";
|
||||||
|
|
||||||
|
// if it's an array of i8s, also provide a version that takes a const
|
||||||
|
// char *
|
||||||
|
if (ATy->getElementType() == LLVMTypes::Int8Type) {
|
||||||
|
Out << " static " << NameSoFar << " init(const char *p) {\n";
|
||||||
|
Out << " " << NameSoFar << " ret;\n";
|
||||||
|
Out << " strncpy((char *)ret.array, p, " << NumElements << ");\n";
|
||||||
|
Out << " return ret;\n";
|
||||||
|
Out << " }\n";
|
||||||
|
}
|
||||||
|
|
||||||
printType(Out, ATy->getElementType(), false,
|
printType(Out, ATy->getElementType(), false,
|
||||||
"array[" + utostr(NumElements) + "]");
|
"array[" + utostr(NumElements) + "]");
|
||||||
return Out << ";\n} ";
|
return Out << ";\n} ";
|
||||||
@@ -1330,7 +1340,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) {
|
|||||||
|
|
||||||
case Type::ArrayTyID: {
|
case Type::ArrayTyID: {
|
||||||
ArrayType *AT = cast<ArrayType>(CPV->getType());
|
ArrayType *AT = cast<ArrayType>(CPV->getType());
|
||||||
if (Static || !isa<StructType>(AT->getElementType()))
|
if (Static)
|
||||||
// arrays are wrapped in structs...
|
// arrays are wrapped in structs...
|
||||||
Out << "{ ";
|
Out << "{ ";
|
||||||
else {
|
else {
|
||||||
@@ -1352,7 +1362,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Static || !isa<StructType>(AT->getElementType()))
|
if (Static)
|
||||||
Out << " }";
|
Out << " }";
|
||||||
else
|
else
|
||||||
Out << ")";
|
Out << ")";
|
||||||
|
|||||||
1
ispc.cpp
1
ispc.cpp
@@ -387,7 +387,6 @@ lGenericTypeLayoutIndeterminate(LLVM_TYPE_CONST llvm::Type *type) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
type->dump();
|
|
||||||
Assert(llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(type));
|
Assert(llvm::isa<LLVM_TYPE_CONST llvm::VectorType>(type));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user