aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-15 04:39:46 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-15 04:39:46 +0000
commitc1eb14a66fdd955aff3f957a5843295f27952bdd (patch)
treeab3738d62044635456c762d297cfef49bbce19e1 /lib/CodeGen
parentaab7efef16e29797e9a7fe4a8e93ad7f58752991 (diff)
Codegen support for nullptr from C++0x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp4
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index aee5446434..7f9b66468b 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -308,6 +308,10 @@ public:
return 0;
}
+ Value *VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E) {
+ return llvm::Constant::getNullValue(ConvertType(E->getType()));
+ }
+
// Binary Operators.
Value *EmitMul(const BinOpInfo &Ops) {
if (CGF.getContext().getLangOptions().OverflowChecking
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 94db836665..6826122ad9 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -229,6 +229,12 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
return getTypeForFormat(getLLVMContext(),
Context.getFloatTypeSemantics(T));
+ case BuiltinType::NullPtr: {
+ // Model std::nullptr_t as i8*
+ const llvm::Type *Ty = llvm::IntegerType::get(getLLVMContext(), 8);
+ return llvm::PointerType::getUnqual(Ty);
+ }
+
case BuiltinType::UInt128:
case BuiltinType::Int128:
return llvm::IntegerType::get(getLLVMContext(), 128);