forked from OSchip/llvm-project
parent
2b979ef128
commit
04c3bf4fab
|
@ -383,7 +383,8 @@ APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
|
|||
|
||||
// Check for pointer->pointer cast
|
||||
if (SubExpr->getType()->isPointerType() ||
|
||||
SubExpr->getType()->isObjCObjectPointerType()) {
|
||||
SubExpr->getType()->isObjCObjectPointerType() ||
|
||||
SubExpr->getType()->isNullPtrType()) {
|
||||
APValue Result;
|
||||
if (EvaluatePointer(SubExpr, Result, Info))
|
||||
return Result;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: clang-cc -std=c++0x %s -emit-llvm -o %t
|
||||
|
||||
int* a = nullptr;
|
||||
|
||||
void f() {
|
||||
int* a = nullptr;
|
||||
}
|
Loading…
Reference in New Issue