- Address Richard's review comments.
Hi rsmith, rjmccall, eli.friedman, doug.gregor,
http://llvm-reviews.chandlerc.com/D1625
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1625?vs=4124&id=4129#toc
Files:
docs/ReleaseNotes.rst
lib/AST/ItaniumMangle.cpp
test/CodeGenCXX/mangle-nullptr-arg.cpp
Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -81,7 +81,10 @@
member offsets for classes inheriting from certain classes with tail padding.
See PR16537.
-- ...
+- Fixed non-conformance with the Itanium C++ ABI wherein the external name
+ generated for a template parameter of type std::nullptr_t with a
corresponding
+ template argument of nullptr would be incorrect. This is an ABI breaking
+ change. See PR17141.
C++11 Feature Support
^^^^^^^^^^^^^^^^^^^^^
Index: lib/AST/ItaniumMangle.cpp
===================================================================
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -3337,10 +3337,15 @@
break;
}
case TemplateArgument::NullPtr: {
+ // <expr-primary> ::= L <nullptr type> E
// <expr-primary> ::= L <type> 0 E
- Out << 'L';
- mangleType(A.getNullPtrType());
- Out << "0E";
+ if (A.getNullPtrType()->isNullPtrType())
+ Out << "LDnE";
+ else {
+ Out << 'L';
+ mangleType(A.getNullPtrType());
+ Out << "0E";
+ }
break;
}
case TemplateArgument::Pack: {
Index: test/CodeGenCXX/mangle-nullptr-arg.cpp
===================================================================
--- test/CodeGenCXX/mangle-nullptr-arg.cpp
+++ test/CodeGenCXX/mangle-nullptr-arg.cpp
@@ -14,3 +14,8 @@
// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLS0_0EE
template<typename T, T x> struct DependentTypePtr {};
void test3(DependentTypePtr<int*,nullptr>) { }
+
+template<decltype(nullptr)> struct NP {};
+
+// CHECK-LABEL: define void @_Z5test42NPILDnEE
+void test4(NP<nullptr>) {}
Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -81,7 +81,10 @@
member offsets for classes inheriting from certain classes with tail padding.
See PR16537.
-- ...
+- Fixed non-conformance with the Itanium C++ ABI wherein the external name
+ generated for a template parameter of type std::nullptr_t with a corresponding
+ template argument of nullptr would be incorrect. This is an ABI breaking
+ change. See PR17141.
C++11 Feature Support
^^^^^^^^^^^^^^^^^^^^^
Index: lib/AST/ItaniumMangle.cpp
===================================================================
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -3337,10 +3337,15 @@
break;
}
case TemplateArgument::NullPtr: {
+ // <expr-primary> ::= L <nullptr type> E
// <expr-primary> ::= L <type> 0 E
- Out << 'L';
- mangleType(A.getNullPtrType());
- Out << "0E";
+ if (A.getNullPtrType()->isNullPtrType())
+ Out << "LDnE";
+ else {
+ Out << 'L';
+ mangleType(A.getNullPtrType());
+ Out << "0E";
+ }
break;
}
case TemplateArgument::Pack: {
Index: test/CodeGenCXX/mangle-nullptr-arg.cpp
===================================================================
--- test/CodeGenCXX/mangle-nullptr-arg.cpp
+++ test/CodeGenCXX/mangle-nullptr-arg.cpp
@@ -14,3 +14,8 @@
// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLS0_0EE
template<typename T, T x> struct DependentTypePtr {};
void test3(DependentTypePtr<int*,nullptr>) { }
+
+template<decltype(nullptr)> struct NP {};
+
+// CHECK-LABEL: define void @_Z5test42NPILDnEE
+void test4(NP<nullptr>) {}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits