From 2683fd6f8c930e30d51ddfd5fa6c91658e6202db Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 4 Nov 2010 04:31:32 +0000 Subject: [PATCH] Mangle std::nullptr_t as specified by the Itanium C++ ABI. llvm-svn: 118236 --- clang/lib/CodeGen/Mangle.cpp | 5 ++--- clang/test/CodeGenCXX/mangle.cpp | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp index 37ecf285983f..d1e3a98789e7 100644 --- a/clang/lib/CodeGen/Mangle.cpp +++ b/clang/lib/CodeGen/Mangle.cpp @@ -1219,9 +1219,8 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { // UNSUPPORTED: ::= Dh # IEEE 754r half-precision floating point (16 bits) // ::= Di # char32_t // ::= Ds # char16_t + // ::= Dn # std::nullptr_t (i.e., decltype(nullptr)) // ::= u # vendor extended type - // From our point of view, std::nullptr_t is a builtin, but as far as mangling - // is concerned, it's a type called std::nullptr_t. switch (T->getKind()) { case BuiltinType::Void: Out << 'v'; break; case BuiltinType::Bool: Out << 'b'; break; @@ -1244,7 +1243,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { case BuiltinType::Float: Out << 'f'; break; case BuiltinType::Double: Out << 'd'; break; case BuiltinType::LongDouble: Out << 'e'; break; - case BuiltinType::NullPtr: Out << "St9nullptr_t"; break; + case BuiltinType::NullPtr: Out << "Dn"; break; case BuiltinType::Overload: case BuiltinType::Dependent: diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index e78ad3996eeb..b5207a1712f4 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -630,3 +630,8 @@ namespace test21 { // CHECK: define void @_ZN6test2112vla_arg_funcEiPA_i( void vla_arg_func(int X, int a[X][X]) {} } + +namespace test22 { + // CHECK: define void @_ZN6test221fEDn( + void f(decltype(nullptr)) { } +}