[PATCH] AST: Mangle nullptr properly in template args for the Itanium ABI
David Majnemer
david.majnemer at gmail.com
Sat Sep 7 02:39:32 PDT 2013
Hi rsmith, rjmccall, eli.friedman, doug.gregor,
We would previously treat nullptr literals as we were mangling the for
the null pointer value of the template parameter's type instead.
This fixes PR17141.
http://llvm-reviews.chandlerc.com/D1625
Files:
lib/AST/ItaniumMangle.cpp
test/CodeGenCXX/mangle-nullptr-arg.cpp
test/CodeGenCXX/visibility.cpp
Index: lib/AST/ItaniumMangle.cpp
===================================================================
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -3337,10 +3337,8 @@
break;
}
case TemplateArgument::NullPtr: {
- // <expr-primary> ::= L <type> 0 E
- Out << 'L';
- mangleType(A.getNullPtrType());
- Out << "0E";
+ // <expr-primary> ::= L <nullptr type> E
+ Out << "LDnE";
break;
}
case TemplateArgument::Pack: {
Index: test/CodeGenCXX/mangle-nullptr-arg.cpp
===================================================================
--- test/CodeGenCXX/mangle-nullptr-arg.cpp
+++ test/CodeGenCXX/mangle-nullptr-arg.cpp
@@ -2,15 +2,15 @@
template<int *ip> struct IP {};
-// CHECK-LABEL: define void @_Z5test12IPILPi0EE
+// CHECK-LABEL: define void @_Z5test12IPILDnEE
void test1(IP<nullptr>) {}
struct X{ };
template<int X::*pm> struct PM {};
-// CHECK-LABEL: define void @_Z5test22PMILM1Xi0EE
+// CHECK-LABEL: define void @_Z5test22PMILDnEE
void test2(PM<nullptr>) { }
-// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLS0_0EE
+// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLDnEE
template<typename T, T x> struct DependentTypePtr {};
void test3(DependentTypePtr<int*,nullptr>) { }
Index: test/CodeGenCXX/visibility.cpp
===================================================================
--- test/CodeGenCXX/visibility.cpp
+++ test/CodeGenCXX/visibility.cpp
@@ -971,8 +971,8 @@
void f() {
zed<nullptr>();
}
- // CHECK-LABEL: define internal void @_ZN6test523zedILPNS_12_GLOBAL__N_13fooE0EEEvv
- // CHECK-HIDDEN-LABEL: define internal void @_ZN6test523zedILPNS_12_GLOBAL__N_13fooE0EEEvv
+ // CHECK-LABEL: define internal void @_ZN6test523zedILDnEEEvv
+ // CHECK-HIDDEN-LABEL: define internal void @_ZN6test523zedILDnEEEvv
}
namespace test53 {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1625.1.patch
Type: text/x-patch
Size: 1847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130907/b6ed6166/attachment.bin>
More information about the cfe-commits
mailing list