From 5952feccc42bd2ff059a9a407c5bd702731df996 Mon Sep 17 00:00:00 2001 From: Chen Steenvoorden Date: Wed, 27 Dec 2023 15:22:55 +0100 Subject: [PATCH] Allow std::nullptr_t in client functions --- clang/include/clang/Sema/SemaCheerp.h | 2 +- clang/lib/Sema/SemaCheerp.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Sema/SemaCheerp.h b/clang/include/clang/Sema/SemaCheerp.h index 15733e6640f1..ae6f5e51c696 100644 --- a/clang/include/clang/Sema/SemaCheerp.h +++ b/clang/include/clang/Sema/SemaCheerp.h @@ -24,7 +24,7 @@ namespace cheerp{ enum class TypeKind { - Void, Boolean, IntLess32Bit, UnsignedInt32Bit, SignedInt32Bit, IntGreater32Bit, FloatingPoint, NamespaceClient, Pointer, Function, FunctionPointer, Reference, JsExportable, Other, Impossible, + Void, Boolean, IntLess32Bit, UnsignedInt32Bit, SignedInt32Bit, IntGreater32Bit, FloatingPoint, NamespaceClient, Pointer, Function, FunctionPointer, Reference, JsExportable, Other, Impossible, NullPtr, }; enum class SpecialFunctionClassify diff --git a/clang/lib/Sema/SemaCheerp.cpp b/clang/lib/Sema/SemaCheerp.cpp index 06d61b650481..7e57bf1653f3 100644 --- a/clang/lib/Sema/SemaCheerp.cpp +++ b/clang/lib/Sema/SemaCheerp.cpp @@ -196,6 +196,7 @@ void cheerp::TypeChecker::checkTypeImpl(const clang::QualType& Ty, clang::Source case TypeKind::UnsignedInt32Bit: case TypeKind::SignedInt32Bit: case TypeKind::FloatingPoint: + case TypeKind::NullPtr: { //Good! return; @@ -335,6 +336,10 @@ cheerp::TypeKind cheerp::TypeChecker::classifyType(const clang::QualType& Qy, co { return TypeKind::Pointer; } + if (Ty->isNullPtrType()) + { + return TypeKind::NullPtr; + } const clang::CXXRecordDecl* Record = Ty->getAsCXXRecordDecl(); if (Record == NULL)