[PATCH] AST: Mangle nullptr properly in template args for the Itanium ABI
David Majnemer
david.majnemer at gmail.com
Sat Sep 7 13:21:00 PDT 2013
- 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>) {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1625.2.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130907/2c31cac5/attachment.bin>
More information about the cfe-commits
mailing list