[PATCH] D31976: Avoid assert when a non-static member function is qualified with __unaligned
Roger Ferrer Ibanez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 19 05:36:16 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300686: Avoid assert when a non-static member function is qualified with __unaligned (authored by rogfer01).
Changed prior to commit:
https://reviews.llvm.org/D31976?vs=94962&id=95723#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31976
Files:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp
Index: cfe/trunk/test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp
+++ cfe/trunk/test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fms-extensions -emit-llvm-only %s -verify
+
+struct A
+{
+ int x;
+ void foo() __unaligned;
+ void foo();
+};
+
+void A::foo() __unaligned
+{
+ this->x++;
+}
+
+void A::foo() // expected-error {{definition with same mangled name as another definition}}
+ // expected-note at -6 {{previous definition is here}}
+{
+ this->x++;
+}
+
Index: cfe/trunk/lib/AST/ItaniumMangle.cpp
===================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp
@@ -1455,10 +1455,12 @@
Out << 'N';
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(ND)) {
Qualifiers MethodQuals =
- Qualifiers::fromCVRMask(Method->getTypeQualifiers());
+ Qualifiers::fromCVRUMask(Method->getTypeQualifiers());
// We do not consider restrict a distinguishing attribute for overloading
// purposes so we must not mangle it.
MethodQuals.removeRestrict();
+ // __unaligned is not currently mangled in any way, so remove it.
+ MethodQuals.removeUnaligned();
mangleQualifiers(MethodQuals);
mangleRefQualifier(Method->getRefQualifier());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31976.95723.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/6d604187/attachment.bin>
More information about the cfe-commits
mailing list