Merge pull request #733 from jbrodman/master

Modify alloy.py to put dbg llvm builds in different folders. Disallow initializing void * with ptr to const. (#731)
This commit is contained in:
Dmitry Babokin
2014-02-05 11:32:25 +03:00
3 changed files with 17 additions and 0 deletions

View File

@@ -105,6 +105,8 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
revision = "-" + revision revision = "-" + revision
if folder == "": if folder == "":
folder = FOLDER_NAME folder = FOLDER_NAME
if debug == True:
folder = folder + "dbg"
LLVM_SRC="llvm-" + folder LLVM_SRC="llvm-" + folder
LLVM_BUILD="build-" + folder LLVM_BUILD="build-" + folder
LLVM_BIN="bin-" + folder LLVM_BIN="bin-" + folder

View File

@@ -339,7 +339,14 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr,
return false; return false;
} }
else if (PointerType::IsVoidPointer(toPointerType)) { else if (PointerType::IsVoidPointer(toPointerType)) {
if (fromPointerType->GetBaseType()->IsConstType()) {
if (!failureOk)
Error(pos, "Can't convert pointer to const \"%s\" to void pointer.",
fromPointerType->GetString().c_str());
return false;
}
// any pointer type can be converted to a void * // any pointer type can be converted to a void *
// ...almost. #731
goto typecast_ok; goto typecast_ok;
} }
else if (PointerType::IsVoidPointer(fromPointerType) && else if (PointerType::IsVoidPointer(fromPointerType) &&

View File

@@ -3003,6 +3003,14 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) {
return NULL; return NULL;
} }
else { else {
if (Type::Equal(baseType, AtomicType::UniformBool)) {
// Blast bools to ints, but do it here to preserve encoding for
// printing 'true' or 'false'
expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 :
AtomicType::VaryingInt32,
expr, expr->pos);
type = expr->GetType();
}
argTypes.push_back(t); argTypes.push_back(t);
llvm::Type *llvmExprType = type->LLVMType(g->ctx); llvm::Type *llvmExprType = type->LLVMType(g->ctx);