summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-06-03 07:25:34 +0000
committerChris Lattner <sabre@nondot.org>2007-06-03 07:25:34 +0000
commitb16f455e8ce98b2bb44b857299a3a329e4cf0962 (patch)
tree24995f97c951b8783a0ff2f5f7adb48841bd9ce8 /clang/CodeGen
parentcf25024828679bc215766b52fcb7f201ddcffc37 (diff)
downloadbcm5719-llvm-b16f455e8ce98b2bb44b857299a3a329e4cf0962.tar.gz
bcm5719-llvm-b16f455e8ce98b2bb44b857299a3a329e4cf0962.zip
Type::isSignedInteger() and isUnsignedInteger() did not properly account for
'char', which varies based on the target. Instead of spreading target knowledge throughout the compiler, bifurcate char into Char_S and Char_U, and have ASTContext create the right one based on the target, when it starts up. llvm-svn: 39577
Diffstat (limited to 'clang/CodeGen')
-rw-r--r--clang/CodeGen/CGExpr.cpp5
-rw-r--r--clang/CodeGen/CodeGenFunction.cpp3
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/CodeGen/CGExpr.cpp b/clang/CodeGen/CGExpr.cpp
index 87cfd1d82b2..17c7c016743 100644
--- a/clang/CodeGen/CGExpr.cpp
+++ b/clang/CodeGen/CGExpr.cpp
@@ -37,7 +37,8 @@ Value *CodeGenFunction::EvaluateScalarValueToBool(ExprResult Val, QualType Ty) {
assert(Result->getType() == llvm::Type::Int1Ty &&
"Unexpected bool value type!");
return Result;
- case BuiltinType::Char:
+ case BuiltinType::Char_S:
+ case BuiltinType::Char_U:
case BuiltinType::SChar:
case BuiltinType::UChar:
case BuiltinType::Short:
@@ -190,8 +191,6 @@ ExprResult CodeGenFunction::EmitExprWithUsualUnaryConversions(const Expr *E,
// FIXME: this probably isn't right, pending clarification from Steve.
llvm::Value *Val = EmitExpr(E).getVal();
- // FIXME: this doesn't handle 'char'!.
-
// If the input is a signed integer, sign extend to the destination.
if (ResTy->isSignedIntegerType()) {
Val = Builder.CreateSExt(Val, LLVMIntTy, "promote");
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp
index 9da66c635bd..57d9e8be660 100644
--- a/clang/CodeGen/CodeGenFunction.cpp
+++ b/clang/CodeGen/CodeGenFunction.cpp
@@ -51,7 +51,8 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
case BuiltinType::Void:
// LLVM void type can only be used as the result of a function call. Just
// map to the same as char.
- case BuiltinType::Char:
+ case BuiltinType::Char_S:
+ case BuiltinType::Char_U:
case BuiltinType::SChar:
case BuiltinType::UChar:
return IntegerType::get(Target.getCharWidth(Loc));
OpenPOWER on IntegriCloud