r256583 - [MS ABI] Add a mangling for _Complex
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 29 14:02:15 PST 2015
Author: majnemer
Date: Tue Dec 29 16:02:15 2015
New Revision: 256583
URL: http://llvm.org/viewvc/llvm-project?rev=256583&view=rev
Log:
[MS ABI] Add a mangling for _Complex
MSVC doesn't implement a mangling for C99's _Complex so we must invent
our own.
For now, treating it like a class type called _Complex in the __clang
namespace.
This means that 'void f(__Complex int))'
will demangle as: 'void f(struct __clang::_Complex<int>)'
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=256583&r1=256582&r2=256583&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Dec 29 16:02:15 2015
@@ -2207,11 +2207,16 @@ void MicrosoftCXXNameMangler::mangleType
void MicrosoftCXXNameMangler::mangleType(const ComplexType *T, Qualifiers,
SourceRange Range) {
- DiagnosticsEngine &Diags = Context.getDiags();
- unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
- "cannot mangle this complex number type yet");
- Diags.Report(Range.getBegin(), DiagID)
- << Range;
+ QualType ElementType = T->getElementType();
+
+ llvm::SmallString<64> TemplateMangling;
+ llvm::raw_svector_ostream Stream(TemplateMangling);
+ MicrosoftCXXNameMangler Extra(Context, Stream);
+ Stream << "?$";
+ Extra.mangleSourceName("_Complex");
+ Extra.mangleType(ElementType, Range, QMM_Escape);
+
+ mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__clang"});
}
void MicrosoftCXXNameMangler::mangleType(const VectorType *T, Qualifiers Quals,
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=256583&r1=256582&r2=256583&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Tue Dec 29 16:02:15 2015
@@ -442,3 +442,7 @@ namespace Atomic {
// CHECK-DAG: define void @"\01?f at Atomic@@YAXU?$_Atomic at H@__clang@@@Z"(
void f(_Atomic(int)) {}
}
+namespace Complex {
+// CHECK-DAG: define void @"\01?f at Complex@@YAXU?$_Complex at H@__clang@@@Z"(
+void f(_Complex int) {}
+}
More information about the cfe-commits
mailing list