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 {
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 {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits