MicrosoftMangle.cpp revision 218887
1//===--- MicrosoftMangle.cpp - Microsoft Visual C++ Name Mangling ---------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This provides C++ name mangling targetting the Microsoft Visual C++ ABI. 11// 12//===----------------------------------------------------------------------===// 13 14#include "clang/AST/Mangle.h" 15#include "clang/AST/ASTContext.h" 16#include "clang/AST/CharUnits.h" 17#include "clang/AST/Decl.h" 18#include "clang/AST/DeclCXX.h" 19#include "clang/AST/DeclObjC.h" 20#include "clang/AST/DeclTemplate.h" 21#include "clang/AST/ExprCXX.h" 22#include "clang/Basic/ABI.h" 23 24using namespace clang; 25 26namespace { 27 28/// MicrosoftCXXNameMangler - Manage the mangling of a single name for the 29/// Microsoft Visual C++ ABI. 30class MicrosoftCXXNameMangler { 31 MangleContext &Context; 32 llvm::raw_ostream &Out; 33 34 ASTContext &getASTContext() const { return Context.getASTContext(); } 35 36public: 37 MicrosoftCXXNameMangler(MangleContext &C, llvm::raw_ostream &Out_) 38 : Context(C), Out(Out_) { } 39 40 void mangle(const NamedDecl *D, llvm::StringRef Prefix = "?"); 41 void mangleName(const NamedDecl *ND); 42 void mangleFunctionEncoding(const FunctionDecl *FD); 43 void mangleVariableEncoding(const VarDecl *VD); 44 void mangleNumber(int64_t Number); 45 void mangleType(QualType T); 46 47private: 48 void mangleUnqualifiedName(const NamedDecl *ND) { 49 mangleUnqualifiedName(ND, ND->getDeclName()); 50 } 51 void mangleUnqualifiedName(const NamedDecl *ND, DeclarationName Name); 52 void mangleSourceName(const IdentifierInfo *II); 53 void manglePostfix(const DeclContext *DC, bool NoFunction=false); 54 void mangleOperatorName(OverloadedOperatorKind OO); 55 void mangleQualifiers(Qualifiers Quals, bool IsMember); 56 57 void mangleObjCMethodName(const ObjCMethodDecl *MD); 58 59 // Declare manglers for every type class. 60#define ABSTRACT_TYPE(CLASS, PARENT) 61#define NON_CANONICAL_TYPE(CLASS, PARENT) 62#define TYPE(CLASS, PARENT) void mangleType(const CLASS##Type *T); 63#include "clang/AST/TypeNodes.def" 64 65 void mangleType(const TagType*); 66 void mangleType(const FunctionType *T, const FunctionDecl *D, 67 bool IsStructor, bool IsInstMethod); 68 void mangleType(const ArrayType *T, bool IsGlobal); 69 void mangleExtraDimensions(QualType T); 70 void mangleFunctionClass(const FunctionDecl *FD); 71 void mangleCallingConvention(const FunctionType *T, bool IsInstMethod = false); 72 void mangleThrowSpecification(const FunctionProtoType *T); 73 74}; 75 76/// MicrosoftMangleContext - Overrides the default MangleContext for the 77/// Microsoft Visual C++ ABI. 78class MicrosoftMangleContext : public MangleContext { 79public: 80 MicrosoftMangleContext(ASTContext &Context, 81 Diagnostic &Diags) : MangleContext(Context, Diags) { } 82 virtual bool shouldMangleDeclName(const NamedDecl *D); 83 virtual void mangleName(const NamedDecl *D, llvm::raw_ostream &Out); 84 virtual void mangleThunk(const CXXMethodDecl *MD, 85 const ThunkInfo &Thunk, 86 llvm::raw_ostream &); 87 virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, 88 const ThisAdjustment &ThisAdjustment, 89 llvm::raw_ostream &); 90 virtual void mangleCXXVTable(const CXXRecordDecl *RD, 91 llvm::raw_ostream &); 92 virtual void mangleCXXVTT(const CXXRecordDecl *RD, 93 llvm::raw_ostream &); 94 virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, 95 const CXXRecordDecl *Type, 96 llvm::raw_ostream &); 97 virtual void mangleCXXRTTI(QualType T, llvm::raw_ostream &); 98 virtual void mangleCXXRTTIName(QualType T, llvm::raw_ostream &); 99 virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, 100 llvm::raw_ostream &); 101 virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, 102 llvm::raw_ostream &); 103 virtual void mangleReferenceTemporary(const clang::VarDecl *, 104 llvm::raw_ostream &); 105}; 106 107} 108 109static bool isInCLinkageSpecification(const Decl *D) { 110 D = D->getCanonicalDecl(); 111 for (const DeclContext *DC = D->getDeclContext(); 112 !DC->isTranslationUnit(); DC = DC->getParent()) { 113 if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC)) 114 return Linkage->getLanguage() == LinkageSpecDecl::lang_c; 115 } 116 117 return false; 118} 119 120bool MicrosoftMangleContext::shouldMangleDeclName(const NamedDecl *D) { 121 // In C, functions with no attributes never need to be mangled. Fastpath them. 122 if (!getASTContext().getLangOptions().CPlusPlus && !D->hasAttrs()) 123 return false; 124 125 // Any decl can be declared with __asm("foo") on it, and this takes precedence 126 // over all other naming in the .o file. 127 if (D->hasAttr<AsmLabelAttr>()) 128 return true; 129 130 // Clang's "overloadable" attribute extension to C/C++ implies name mangling 131 // (always) as does passing a C++ member function and a function 132 // whose name is not a simple identifier. 133 const FunctionDecl *FD = dyn_cast<FunctionDecl>(D); 134 if (FD && (FD->hasAttr<OverloadableAttr>() || isa<CXXMethodDecl>(FD) || 135 !FD->getDeclName().isIdentifier())) 136 return true; 137 138 // Otherwise, no mangling is done outside C++ mode. 139 if (!getASTContext().getLangOptions().CPlusPlus) 140 return false; 141 142 // Variables at global scope with internal linkage are not mangled. 143 if (!FD) { 144 const DeclContext *DC = D->getDeclContext(); 145 if (DC->isTranslationUnit() && D->getLinkage() == InternalLinkage) 146 return false; 147 } 148 149 // C functions and "main" are not mangled. 150 if ((FD && FD->isMain()) || isInCLinkageSpecification(D)) 151 return false; 152 153 return true; 154} 155 156void MicrosoftCXXNameMangler::mangle(const NamedDecl *D, 157 llvm::StringRef Prefix) { 158 // MSVC doesn't mangle C++ names the same way it mangles extern "C" names. 159 // Therefore it's really important that we don't decorate the 160 // name with leading underscores or leading/trailing at signs. So, emit a 161 // asm marker at the start so we get the name right. 162 Out << '\01'; // LLVM IR Marker for __asm("foo") 163 164 // Any decl can be declared with __asm("foo") on it, and this takes precedence 165 // over all other naming in the .o file. 166 if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) { 167 // If we have an asm name, then we use it as the mangling. 168 Out << ALA->getLabel(); 169 return; 170 } 171 172 // <mangled-name> ::= ? <name> <type-encoding> 173 Out << Prefix; 174 mangleName(D); 175 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) 176 mangleFunctionEncoding(FD); 177 else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) 178 mangleVariableEncoding(VD); 179 // TODO: Fields? Can MSVC even mangle them? 180} 181 182void MicrosoftCXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) { 183 // <type-encoding> ::= <function-class> <function-type> 184 185 // Don't mangle in the type if this isn't a decl we should typically mangle. 186 if (!Context.shouldMangleDeclName(FD)) 187 return; 188 189 // We should never ever see a FunctionNoProtoType at this point. 190 // We don't even know how to mangle their types anyway :). 191 const FunctionProtoType *FT = cast<FunctionProtoType>(FD->getType()); 192 193 bool InStructor = false, InInstMethod = false; 194 const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); 195 if (MD) { 196 if (MD->isInstance()) 197 InInstMethod = true; 198 if (isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD)) 199 InStructor = true; 200 } 201 202 // First, the function class. 203 mangleFunctionClass(FD); 204 205 mangleType(FT, FD, InStructor, InInstMethod); 206} 207 208void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) { 209 // <type-encoding> ::= <storage-class> <variable-type> 210 // <storage-class> ::= 0 # private static member 211 // ::= 1 # protected static member 212 // ::= 2 # public static member 213 // ::= 3 # global 214 // ::= 4 # static local 215 216 // The first character in the encoding (after the name) is the storage class. 217 if (VD->isStaticDataMember()) { 218 // If it's a static member, it also encodes the access level. 219 switch (VD->getAccess()) { 220 default: 221 case AS_private: Out << '0'; break; 222 case AS_protected: Out << '1'; break; 223 case AS_public: Out << '2'; break; 224 } 225 } 226 else if (!VD->isStaticLocal()) 227 Out << '3'; 228 else 229 Out << '4'; 230 // Now mangle the type. 231 // <variable-type> ::= <type> <cvr-qualifiers> 232 // ::= <type> A # pointers, references, arrays 233 // Pointers and references are odd. The type of 'int * const foo;' gets 234 // mangled as 'QAHA' instead of 'PAHB', for example. 235 QualType Ty = VD->getType(); 236 if (Ty->isPointerType() || Ty->isReferenceType()) { 237 mangleType(Ty); 238 Out << 'A'; 239 } else if (Ty->isArrayType()) { 240 // Global arrays are funny, too. 241 mangleType(cast<ArrayType>(Ty.getTypePtr()), true); 242 Out << 'A'; 243 } else { 244 mangleType(Ty.getLocalUnqualifiedType()); 245 mangleQualifiers(Ty.getLocalQualifiers(), false); 246 } 247} 248 249void MicrosoftCXXNameMangler::mangleName(const NamedDecl *ND) { 250 // <name> ::= <unscoped-name> {[<named-scope>]+ | [<nested-name>]}? @ 251 const DeclContext *DC = ND->getDeclContext(); 252 253 // Always start with the unqualified name. 254 mangleUnqualifiedName(ND); 255 256 // If this is an extern variable declared locally, the relevant DeclContext 257 // is that of the containing namespace, or the translation unit. 258 if (isa<FunctionDecl>(DC) && ND->hasLinkage()) 259 while (!DC->isNamespace() && !DC->isTranslationUnit()) 260 DC = DC->getParent(); 261 262 manglePostfix(DC); 263 264 // Terminate the whole name with an '@'. 265 Out << '@'; 266} 267 268void MicrosoftCXXNameMangler::mangleNumber(int64_t Number) { 269 // <number> ::= [?] <decimal digit> # <= 9 270 // ::= [?] <hex digit>+ @ # > 9; A = 0, B = 1, etc... 271 if (Number < 0) { 272 Out << '?'; 273 Number = -Number; 274 } 275 if (Number >= 1 && Number <= 10) { 276 Out << Number-1; 277 } else { 278 // We have to build up the encoding in reverse order, so it will come 279 // out right when we write it out. 280 char Encoding[16]; 281 char *EndPtr = Encoding+sizeof(Encoding); 282 char *CurPtr = EndPtr; 283 while (Number) { 284 *--CurPtr = 'A' + (Number % 16); 285 Number /= 16; 286 } 287 Out.write(CurPtr, EndPtr-CurPtr); 288 Out << '@'; 289 } 290} 291 292void 293MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, 294 DeclarationName Name) { 295 // <unqualified-name> ::= <operator-name> 296 // ::= <ctor-dtor-name> 297 // ::= <source-name> 298 switch (Name.getNameKind()) { 299 case DeclarationName::Identifier: { 300 if (const IdentifierInfo *II = Name.getAsIdentifierInfo()) { 301 mangleSourceName(II); 302 break; 303 } 304 305 // Otherwise, an anonymous entity. We must have a declaration. 306 assert(ND && "mangling empty name without declaration"); 307 308 if (const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) { 309 if (NS->isAnonymousNamespace()) { 310 Out << "?A"; 311 break; 312 } 313 } 314 315 // We must have an anonymous struct. 316 const TagDecl *TD = cast<TagDecl>(ND); 317 if (const TypedefDecl *D = TD->getTypedefForAnonDecl()) { 318 assert(TD->getDeclContext() == D->getDeclContext() && 319 "Typedef should not be in another decl context!"); 320 assert(D->getDeclName().getAsIdentifierInfo() && 321 "Typedef was not named!"); 322 mangleSourceName(D->getDeclName().getAsIdentifierInfo()); 323 break; 324 } 325 326 // When VC encounters an anonymous type with no tag and no typedef, 327 // it literally emits '<unnamed-tag>'. 328 Out << "<unnamed-tag>"; 329 break; 330 } 331 332 case DeclarationName::ObjCZeroArgSelector: 333 case DeclarationName::ObjCOneArgSelector: 334 case DeclarationName::ObjCMultiArgSelector: 335 assert(false && "Can't mangle Objective-C selector names here!"); 336 break; 337 338 case DeclarationName::CXXConstructorName: 339 assert(false && "Can't mangle constructors yet!"); 340 break; 341 342 case DeclarationName::CXXDestructorName: 343 assert(false && "Can't mangle destructors yet!"); 344 break; 345 346 case DeclarationName::CXXConversionFunctionName: 347 // <operator-name> ::= ?B # (cast) 348 // The target type is encoded as the return type. 349 Out << "?B"; 350 break; 351 352 case DeclarationName::CXXOperatorName: 353 mangleOperatorName(Name.getCXXOverloadedOperator()); 354 break; 355 356 case DeclarationName::CXXLiteralOperatorName: 357 // FIXME: Was this added in VS2010? Does MS even know how to mangle this? 358 assert(false && "Don't know how to mangle literal operators yet!"); 359 break; 360 361 case DeclarationName::CXXUsingDirective: 362 assert(false && "Can't mangle a using directive name!"); 363 break; 364 } 365} 366 367void MicrosoftCXXNameMangler::manglePostfix(const DeclContext *DC, 368 bool NoFunction) { 369 // <postfix> ::= <unqualified-name> [<postfix>] 370 // ::= <template-postfix> <template-args> [<postfix>] 371 // ::= <template-param> 372 // ::= <substitution> [<postfix>] 373 374 if (!DC) return; 375 376 while (isa<LinkageSpecDecl>(DC)) 377 DC = DC->getParent(); 378 379 if (DC->isTranslationUnit()) 380 return; 381 382 if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) { 383 Context.mangleBlock(BD, Out); 384 Out << '@'; 385 return manglePostfix(DC->getParent(), NoFunction); 386 } 387 388 if (NoFunction && (isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC))) 389 return; 390 else if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC)) 391 mangleObjCMethodName(Method); 392 else { 393 mangleUnqualifiedName(cast<NamedDecl>(DC)); 394 manglePostfix(DC->getParent(), NoFunction); 395 } 396} 397 398void MicrosoftCXXNameMangler::mangleOperatorName(OverloadedOperatorKind OO) { 399 switch (OO) { 400 // ?0 # constructor 401 // ?1 # destructor 402 // <operator-name> ::= ?2 # new 403 case OO_New: Out << "?2"; break; 404 // <operator-name> ::= ?3 # delete 405 case OO_Delete: Out << "?3"; break; 406 // <operator-name> ::= ?4 # = 407 case OO_Equal: Out << "?4"; break; 408 // <operator-name> ::= ?5 # >> 409 case OO_GreaterGreater: Out << "?5"; break; 410 // <operator-name> ::= ?6 # << 411 case OO_LessLess: Out << "?6"; break; 412 // <operator-name> ::= ?7 # ! 413 case OO_Exclaim: Out << "?7"; break; 414 // <operator-name> ::= ?8 # == 415 case OO_EqualEqual: Out << "?8"; break; 416 // <operator-name> ::= ?9 # != 417 case OO_ExclaimEqual: Out << "?9"; break; 418 // <operator-name> ::= ?A # [] 419 case OO_Subscript: Out << "?A"; break; 420 // ?B # conversion 421 // <operator-name> ::= ?C # -> 422 case OO_Arrow: Out << "?C"; break; 423 // <operator-name> ::= ?D # * 424 case OO_Star: Out << "?D"; break; 425 // <operator-name> ::= ?E # ++ 426 case OO_PlusPlus: Out << "?E"; break; 427 // <operator-name> ::= ?F # -- 428 case OO_MinusMinus: Out << "?F"; break; 429 // <operator-name> ::= ?G # - 430 case OO_Minus: Out << "?G"; break; 431 // <operator-name> ::= ?H # + 432 case OO_Plus: Out << "?H"; break; 433 // <operator-name> ::= ?I # & 434 case OO_Amp: Out << "?I"; break; 435 // <operator-name> ::= ?J # ->* 436 case OO_ArrowStar: Out << "?J"; break; 437 // <operator-name> ::= ?K # / 438 case OO_Slash: Out << "?K"; break; 439 // <operator-name> ::= ?L # % 440 case OO_Percent: Out << "?L"; break; 441 // <operator-name> ::= ?M # < 442 case OO_Less: Out << "?M"; break; 443 // <operator-name> ::= ?N # <= 444 case OO_LessEqual: Out << "?N"; break; 445 // <operator-name> ::= ?O # > 446 case OO_Greater: Out << "?O"; break; 447 // <operator-name> ::= ?P # >= 448 case OO_GreaterEqual: Out << "?P"; break; 449 // <operator-name> ::= ?Q # , 450 case OO_Comma: Out << "?Q"; break; 451 // <operator-name> ::= ?R # () 452 case OO_Call: Out << "?R"; break; 453 // <operator-name> ::= ?S # ~ 454 case OO_Tilde: Out << "?S"; break; 455 // <operator-name> ::= ?T # ^ 456 case OO_Caret: Out << "?T"; break; 457 // <operator-name> ::= ?U # | 458 case OO_Pipe: Out << "?U"; break; 459 // <operator-name> ::= ?V # && 460 case OO_AmpAmp: Out << "?V"; break; 461 // <operator-name> ::= ?W # || 462 case OO_PipePipe: Out << "?W"; break; 463 // <operator-name> ::= ?X # *= 464 case OO_StarEqual: Out << "?X"; break; 465 // <operator-name> ::= ?Y # += 466 case OO_PlusEqual: Out << "?Y"; break; 467 // <operator-name> ::= ?Z # -= 468 case OO_MinusEqual: Out << "?Z"; break; 469 // <operator-name> ::= ?_0 # /= 470 case OO_SlashEqual: Out << "?_0"; break; 471 // <operator-name> ::= ?_1 # %= 472 case OO_PercentEqual: Out << "?_1"; break; 473 // <operator-name> ::= ?_2 # >>= 474 case OO_GreaterGreaterEqual: Out << "?_2"; break; 475 // <operator-name> ::= ?_3 # <<= 476 case OO_LessLessEqual: Out << "?_3"; break; 477 // <operator-name> ::= ?_4 # &= 478 case OO_AmpEqual: Out << "?_4"; break; 479 // <operator-name> ::= ?_5 # |= 480 case OO_PipeEqual: Out << "?_5"; break; 481 // <operator-name> ::= ?_6 # ^= 482 case OO_CaretEqual: Out << "?_6"; break; 483 // ?_7 # vftable 484 // ?_8 # vbtable 485 // ?_9 # vcall 486 // ?_A # typeof 487 // ?_B # local static guard 488 // ?_C # string 489 // ?_D # vbase destructor 490 // ?_E # vector deleting destructor 491 // ?_F # default constructor closure 492 // ?_G # scalar deleting destructor 493 // ?_H # vector constructor iterator 494 // ?_I # vector destructor iterator 495 // ?_J # vector vbase constructor iterator 496 // ?_K # virtual displacement map 497 // ?_L # eh vector constructor iterator 498 // ?_M # eh vector destructor iterator 499 // ?_N # eh vector vbase constructor iterator 500 // ?_O # copy constructor closure 501 // ?_P<name> # udt returning <name> 502 // ?_Q # <unknown> 503 // ?_R0 # RTTI Type Descriptor 504 // ?_R1 # RTTI Base Class Descriptor at (a,b,c,d) 505 // ?_R2 # RTTI Base Class Array 506 // ?_R3 # RTTI Class Hierarchy Descriptor 507 // ?_R4 # RTTI Complete Object Locator 508 // ?_S # local vftable 509 // ?_T # local vftable constructor closure 510 // <operator-name> ::= ?_U # new[] 511 case OO_Array_New: Out << "?_U"; break; 512 // <operator-name> ::= ?_V # delete[] 513 case OO_Array_Delete: Out << "?_V"; break; 514 515 case OO_Conditional: 516 assert(false && "Don't know how to mangle ?:"); 517 break; 518 519 case OO_None: 520 case NUM_OVERLOADED_OPERATORS: 521 assert(false && "Not an overloaded operator"); 522 break; 523 } 524} 525 526void MicrosoftCXXNameMangler::mangleSourceName(const IdentifierInfo *II) { 527 // <source name> ::= <identifier> @ 528 Out << II->getName() << '@'; 529} 530 531void MicrosoftCXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) { 532 Context.mangleObjCMethodName(MD, Out); 533} 534 535void MicrosoftCXXNameMangler::mangleQualifiers(Qualifiers Quals, 536 bool IsMember) { 537 // <cvr-qualifiers> ::= [E] [F] [I] <base-cvr-qualifiers> 538 // 'E' means __ptr64 (32-bit only); 'F' means __unaligned (32/64-bit only); 539 // 'I' means __restrict (32/64-bit). 540 // Note that the MSVC __restrict keyword isn't the same as the C99 restrict 541 // keyword! 542 // <base-cvr-qualifiers> ::= A # near 543 // ::= B # near const 544 // ::= C # near volatile 545 // ::= D # near const volatile 546 // ::= E # far (16-bit) 547 // ::= F # far const (16-bit) 548 // ::= G # far volatile (16-bit) 549 // ::= H # far const volatile (16-bit) 550 // ::= I # huge (16-bit) 551 // ::= J # huge const (16-bit) 552 // ::= K # huge volatile (16-bit) 553 // ::= L # huge const volatile (16-bit) 554 // ::= M <basis> # based 555 // ::= N <basis> # based const 556 // ::= O <basis> # based volatile 557 // ::= P <basis> # based const volatile 558 // ::= Q # near member 559 // ::= R # near const member 560 // ::= S # near volatile member 561 // ::= T # near const volatile member 562 // ::= U # far member (16-bit) 563 // ::= V # far const member (16-bit) 564 // ::= W # far volatile member (16-bit) 565 // ::= X # far const volatile member (16-bit) 566 // ::= Y # huge member (16-bit) 567 // ::= Z # huge const member (16-bit) 568 // ::= 0 # huge volatile member (16-bit) 569 // ::= 1 # huge const volatile member (16-bit) 570 // ::= 2 <basis> # based member 571 // ::= 3 <basis> # based const member 572 // ::= 4 <basis> # based volatile member 573 // ::= 5 <basis> # based const volatile member 574 // ::= 6 # near function (pointers only) 575 // ::= 7 # far function (pointers only) 576 // ::= 8 # near method (pointers only) 577 // ::= 9 # far method (pointers only) 578 // ::= _A <basis> # based function (pointers only) 579 // ::= _B <basis> # based function (far?) (pointers only) 580 // ::= _C <basis> # based method (pointers only) 581 // ::= _D <basis> # based method (far?) (pointers only) 582 // ::= _E # block (Clang) 583 // <basis> ::= 0 # __based(void) 584 // ::= 1 # __based(segment)? 585 // ::= 2 <name> # __based(name) 586 // ::= 3 # ? 587 // ::= 4 # ? 588 // ::= 5 # not really based 589 if (!IsMember) { 590 if (!Quals.hasVolatile()) { 591 if (!Quals.hasConst()) 592 Out << 'A'; 593 else 594 Out << 'B'; 595 } else { 596 if (!Quals.hasConst()) 597 Out << 'C'; 598 else 599 Out << 'D'; 600 } 601 } else { 602 if (!Quals.hasVolatile()) { 603 if (!Quals.hasConst()) 604 Out << 'Q'; 605 else 606 Out << 'R'; 607 } else { 608 if (!Quals.hasConst()) 609 Out << 'S'; 610 else 611 Out << 'T'; 612 } 613 } 614 615 // FIXME: For now, just drop all extension qualifiers on the floor. 616} 617 618void MicrosoftCXXNameMangler::mangleType(QualType T) { 619 // Only operate on the canonical type! 620 T = getASTContext().getCanonicalType(T); 621 622 Qualifiers Quals = T.getLocalQualifiers(); 623 if (Quals) { 624 // We have to mangle these now, while we still have enough information. 625 // <pointer-cvr-qualifiers> ::= P # pointer 626 // ::= Q # const pointer 627 // ::= R # volatile pointer 628 // ::= S # const volatile pointer 629 if (T->isAnyPointerType() || T->isMemberPointerType() || 630 T->isBlockPointerType()) { 631 if (!Quals.hasVolatile()) 632 Out << 'Q'; 633 else { 634 if (!Quals.hasConst()) 635 Out << 'R'; 636 else 637 Out << 'S'; 638 } 639 } else 640 // Just emit qualifiers like normal. 641 // NB: When we mangle a pointer/reference type, and the pointee 642 // type has no qualifiers, the lack of qualifier gets mangled 643 // in there. 644 mangleQualifiers(Quals, false); 645 } else if (T->isAnyPointerType() || T->isMemberPointerType() || 646 T->isBlockPointerType()) { 647 Out << 'P'; 648 } 649 switch (T->getTypeClass()) { 650#define ABSTRACT_TYPE(CLASS, PARENT) 651#define NON_CANONICAL_TYPE(CLASS, PARENT) \ 652case Type::CLASS: \ 653llvm_unreachable("can't mangle non-canonical type " #CLASS "Type"); \ 654return; 655#define TYPE(CLASS, PARENT) \ 656case Type::CLASS: \ 657mangleType(static_cast<const CLASS##Type*>(T.getTypePtr())); \ 658break; 659#include "clang/AST/TypeNodes.def" 660 } 661} 662 663void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T) { 664 // <type> ::= <builtin-type> 665 // <builtin-type> ::= X # void 666 // ::= C # signed char 667 // ::= D # char 668 // ::= E # unsigned char 669 // ::= F # short 670 // ::= G # unsigned short (or wchar_t if it's not a builtin) 671 // ::= H # int 672 // ::= I # unsigned int 673 // ::= J # long 674 // ::= K # unsigned long 675 // L # <none> 676 // ::= M # float 677 // ::= N # double 678 // ::= O # long double (__float80 is mangled differently) 679 // ::= _D # __int8 (yup, it's a distinct type in MSVC) 680 // ::= _E # unsigned __int8 681 // ::= _F # __int16 682 // ::= _G # unsigned __int16 683 // ::= _H # __int32 684 // ::= _I # unsigned __int32 685 // ::= _J # long long, __int64 686 // ::= _K # unsigned long long, __int64 687 // ::= _L # __int128 688 // ::= _M # unsigned __int128 689 // ::= _N # bool 690 // _O # <array in parameter> 691 // ::= _T # __float80 (Intel) 692 // ::= _W # wchar_t 693 // ::= _Z # __float80 (Digital Mars) 694 switch (T->getKind()) { 695 case BuiltinType::Void: Out << 'X'; break; 696 case BuiltinType::SChar: Out << 'C'; break; 697 case BuiltinType::Char_U: case BuiltinType::Char_S: Out << 'D'; break; 698 case BuiltinType::UChar: Out << 'E'; break; 699 case BuiltinType::Short: Out << 'F'; break; 700 case BuiltinType::UShort: Out << 'G'; break; 701 case BuiltinType::Int: Out << 'H'; break; 702 case BuiltinType::UInt: Out << 'I'; break; 703 case BuiltinType::Long: Out << 'J'; break; 704 case BuiltinType::ULong: Out << 'K'; break; 705 case BuiltinType::Float: Out << 'M'; break; 706 case BuiltinType::Double: Out << 'N'; break; 707 // TODO: Determine size and mangle accordingly 708 case BuiltinType::LongDouble: Out << 'O'; break; 709 // TODO: __int8 and friends 710 case BuiltinType::LongLong: Out << "_J"; break; 711 case BuiltinType::ULongLong: Out << "_K"; break; 712 case BuiltinType::Int128: Out << "_L"; break; 713 case BuiltinType::UInt128: Out << "_M"; break; 714 case BuiltinType::Bool: Out << "_N"; break; 715 case BuiltinType::WChar_S: 716 case BuiltinType::WChar_U: Out << "_W"; break; 717 718 case BuiltinType::Overload: 719 case BuiltinType::Dependent: 720 assert(false && 721 "Overloaded and dependent types shouldn't get to name mangling"); 722 break; 723 case BuiltinType::ObjCId: Out << "PAUobjc_object@@"; break; 724 case BuiltinType::ObjCClass: Out << "PAUobjc_class@@"; break; 725 case BuiltinType::ObjCSel: Out << "PAUobjc_selector@@"; break; 726 727 case BuiltinType::Char16: 728 case BuiltinType::Char32: 729 case BuiltinType::NullPtr: 730 assert(false && "Don't know how to mangle this type"); 731 break; 732 } 733} 734 735// <type> ::= <function-type> 736void MicrosoftCXXNameMangler::mangleType(const FunctionProtoType *T) { 737 // Structors only appear in decls, so at this point we know it's not a 738 // structor type. 739 // I'll probably have mangleType(MemberPointerType) call the mangleType() 740 // method directly. 741 mangleType(T, NULL, false, false); 742} 743void MicrosoftCXXNameMangler::mangleType(const FunctionNoProtoType *T) { 744 llvm_unreachable("Can't mangle K&R function prototypes"); 745} 746 747void MicrosoftCXXNameMangler::mangleType(const FunctionType *T, 748 const FunctionDecl *D, 749 bool IsStructor, 750 bool IsInstMethod) { 751 // <function-type> ::= <this-cvr-qualifiers> <calling-convention> 752 // <return-type> <argument-list> <throw-spec> 753 const FunctionProtoType *Proto = cast<FunctionProtoType>(T); 754 755 // If this is a C++ instance method, mangle the CVR qualifiers for the 756 // this pointer. 757 if (IsInstMethod) 758 mangleQualifiers(Qualifiers::fromCVRMask(Proto->getTypeQuals()), false); 759 760 mangleCallingConvention(T, IsInstMethod); 761 762 // <return-type> ::= <type> 763 // ::= @ # structors (they have no declared return type) 764 if (IsStructor) 765 Out << '@'; 766 else 767 mangleType(Proto->getResultType()); 768 769 // <argument-list> ::= X # void 770 // ::= <type>+ @ 771 // ::= <type>* Z # varargs 772 if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) { 773 Out << 'X'; 774 } else { 775 if (D) { 776 // If we got a decl, use the "types-as-written" to make sure arrays 777 // get mangled right. 778 for (FunctionDecl::param_const_iterator Parm = D->param_begin(), 779 ParmEnd = D->param_end(); 780 Parm != ParmEnd; ++Parm) 781 mangleType((*Parm)->getTypeSourceInfo()->getType()); 782 } else { 783 for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(), 784 ArgEnd = Proto->arg_type_end(); 785 Arg != ArgEnd; ++Arg) 786 mangleType(*Arg); 787 } 788 // <builtin-type> ::= Z # ellipsis 789 if (Proto->isVariadic()) 790 Out << 'Z'; 791 else 792 Out << '@'; 793 } 794 795 mangleThrowSpecification(Proto); 796} 797 798void MicrosoftCXXNameMangler::mangleFunctionClass(const FunctionDecl *FD) { 799 // <function-class> ::= A # private: near 800 // ::= B # private: far 801 // ::= C # private: static near 802 // ::= D # private: static far 803 // ::= E # private: virtual near 804 // ::= F # private: virtual far 805 // ::= G # private: thunk near 806 // ::= H # private: thunk far 807 // ::= I # protected: near 808 // ::= J # protected: far 809 // ::= K # protected: static near 810 // ::= L # protected: static far 811 // ::= M # protected: virtual near 812 // ::= N # protected: virtual far 813 // ::= O # protected: thunk near 814 // ::= P # protected: thunk far 815 // ::= Q # public: near 816 // ::= R # public: far 817 // ::= S # public: static near 818 // ::= T # public: static far 819 // ::= U # public: virtual near 820 // ::= V # public: virtual far 821 // ::= W # public: thunk near 822 // ::= X # public: thunk far 823 // ::= Y # global near 824 // ::= Z # global far 825 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) { 826 switch (MD->getAccess()) { 827 default: 828 case AS_private: 829 if (MD->isStatic()) 830 Out << 'C'; 831 else if (MD->isVirtual()) 832 Out << 'E'; 833 else 834 Out << 'A'; 835 break; 836 case AS_protected: 837 if (MD->isStatic()) 838 Out << 'K'; 839 else if (MD->isVirtual()) 840 Out << 'M'; 841 else 842 Out << 'I'; 843 break; 844 case AS_public: 845 if (MD->isStatic()) 846 Out << 'S'; 847 else if (MD->isVirtual()) 848 Out << 'U'; 849 else 850 Out << 'Q'; 851 } 852 } else 853 Out << 'Y'; 854} 855void MicrosoftCXXNameMangler::mangleCallingConvention(const FunctionType *T, 856 bool IsInstMethod) { 857 // <calling-convention> ::= A # __cdecl 858 // ::= B # __export __cdecl 859 // ::= C # __pascal 860 // ::= D # __export __pascal 861 // ::= E # __thiscall 862 // ::= F # __export __thiscall 863 // ::= G # __stdcall 864 // ::= H # __export __stdcall 865 // ::= I # __fastcall 866 // ::= J # __export __fastcall 867 // The 'export' calling conventions are from a bygone era 868 // (*cough*Win16*cough*) when functions were declared for export with 869 // that keyword. (It didn't actually export them, it just made them so 870 // that they could be in a DLL and somebody from another module could call 871 // them.) 872 CallingConv CC = T->getCallConv(); 873 if (CC == CC_Default) 874 CC = IsInstMethod ? getASTContext().getDefaultMethodCallConv() : CC_C; 875 switch (CC) { 876 case CC_Default: 877 case CC_C: Out << 'A'; break; 878 case CC_X86Pascal: Out << 'C'; break; 879 case CC_X86ThisCall: Out << 'E'; break; 880 case CC_X86StdCall: Out << 'G'; break; 881 case CC_X86FastCall: Out << 'I'; break; 882 } 883} 884void MicrosoftCXXNameMangler::mangleThrowSpecification( 885 const FunctionProtoType *FT) { 886 // <throw-spec> ::= Z # throw(...) (default) 887 // ::= @ # throw() or __declspec/__attribute__((nothrow)) 888 // ::= <type>+ 889 // NOTE: Since the Microsoft compiler ignores throw specifications, they are 890 // all actually mangled as 'Z'. (They're ignored because their associated 891 // functionality isn't implemented, and probably never will be.) 892 Out << 'Z'; 893} 894 895void MicrosoftCXXNameMangler::mangleType(const UnresolvedUsingType *T) { 896 assert(false && "Don't know how to mangle UnresolvedUsingTypes yet!"); 897} 898 899// <type> ::= <union-type> | <struct-type> | <class-type> | <enum-type> 900// <union-type> ::= T <name> 901// <struct-type> ::= U <name> 902// <class-type> ::= V <name> 903// <enum-type> ::= W <size> <name> 904void MicrosoftCXXNameMangler::mangleType(const EnumType *T) { 905 mangleType(static_cast<const TagType*>(T)); 906} 907void MicrosoftCXXNameMangler::mangleType(const RecordType *T) { 908 mangleType(static_cast<const TagType*>(T)); 909} 910void MicrosoftCXXNameMangler::mangleType(const TagType *T) { 911 switch (T->getDecl()->getTagKind()) { 912 case TTK_Union: 913 Out << 'T'; 914 break; 915 case TTK_Struct: 916 Out << 'U'; 917 break; 918 case TTK_Class: 919 Out << 'V'; 920 break; 921 case TTK_Enum: 922 Out << 'W'; 923 Out << getASTContext().getTypeSizeInChars( 924 cast<EnumDecl>(T->getDecl())->getIntegerType()).getQuantity(); 925 break; 926 } 927 mangleName(T->getDecl()); 928} 929 930// <type> ::= <array-type> 931// <array-type> ::= P <cvr-qualifiers> [Y <dimension-count> <dimension>+] 932// <element-type> # as global 933// ::= Q <cvr-qualifiers> [Y <dimension-count> <dimension>+] 934// <element-type> # as param 935// It's supposed to be the other way around, but for some strange reason, it 936// isn't. Today this behavior is retained for the sole purpose of backwards 937// compatibility. 938void MicrosoftCXXNameMangler::mangleType(const ArrayType *T, bool IsGlobal) { 939 // This isn't a recursive mangling, so now we have to do it all in this 940 // one call. 941 if (IsGlobal) 942 Out << 'P'; 943 else 944 Out << 'Q'; 945 mangleExtraDimensions(T->getElementType()); 946} 947void MicrosoftCXXNameMangler::mangleType(const ConstantArrayType *T) { 948 mangleType(static_cast<const ArrayType *>(T), false); 949} 950void MicrosoftCXXNameMangler::mangleType(const VariableArrayType *T) { 951 mangleType(static_cast<const ArrayType *>(T), false); 952} 953void MicrosoftCXXNameMangler::mangleType(const DependentSizedArrayType *T) { 954 mangleType(static_cast<const ArrayType *>(T), false); 955} 956void MicrosoftCXXNameMangler::mangleType(const IncompleteArrayType *T) { 957 mangleType(static_cast<const ArrayType *>(T), false); 958} 959void MicrosoftCXXNameMangler::mangleExtraDimensions(QualType ElementTy) { 960 llvm::SmallVector<llvm::APInt, 3> Dimensions; 961 for (;;) { 962 if (ElementTy->isConstantArrayType()) { 963 const ConstantArrayType *CAT = 964 static_cast<const ConstantArrayType *>(ElementTy.getTypePtr()); 965 Dimensions.push_back(CAT->getSize()); 966 ElementTy = CAT->getElementType(); 967 } else if (ElementTy->isVariableArrayType()) { 968 assert(false && "Don't know how to mangle VLAs!"); 969 } else if (ElementTy->isDependentSizedArrayType()) { 970 // The dependent expression has to be folded into a constant (TODO). 971 assert(false && "Don't know how to mangle dependent-sized arrays!"); 972 } else if (ElementTy->isIncompleteArrayType()) continue; 973 else break; 974 } 975 mangleQualifiers(ElementTy.getQualifiers(), false); 976 // If there are any additional dimensions, mangle them now. 977 if (Dimensions.size() > 0) { 978 Out << 'Y'; 979 // <dimension-count> ::= <number> # number of extra dimensions 980 mangleNumber(Dimensions.size()); 981 for (unsigned Dim = 0; Dim < Dimensions.size(); ++Dim) { 982 mangleNumber(Dimensions[Dim].getLimitedValue()); 983 } 984 } 985 mangleType(ElementTy.getLocalUnqualifiedType()); 986} 987 988// <type> ::= <pointer-to-member-type> 989// <pointer-to-member-type> ::= <pointer-cvr-qualifiers> <cvr-qualifiers> 990// <class name> <type> 991void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T) { 992 QualType PointeeType = T->getPointeeType(); 993 if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(PointeeType)) { 994 Out << '8'; 995 mangleName(cast<RecordType>(T->getClass())->getDecl()); 996 mangleType(FPT, NULL, false, true); 997 } else { 998 mangleQualifiers(PointeeType.getQualifiers(), true); 999 mangleName(cast<RecordType>(T->getClass())->getDecl()); 1000 mangleType(PointeeType.getLocalUnqualifiedType()); 1001 } 1002} 1003 1004void MicrosoftCXXNameMangler::mangleType(const TemplateTypeParmType *T) { 1005 assert(false && "Don't know how to mangle TemplateTypeParmTypes yet!"); 1006} 1007 1008void MicrosoftCXXNameMangler::mangleType( 1009 const SubstTemplateTypeParmPackType *T) { 1010 assert(false && 1011 "Don't know how to mangle SubstTemplateTypeParmPackTypes yet!"); 1012} 1013 1014// <type> ::= <pointer-type> 1015// <pointer-type> ::= <pointer-cvr-qualifiers> <cvr-qualifiers> <type> 1016void MicrosoftCXXNameMangler::mangleType(const PointerType *T) { 1017 QualType PointeeTy = T->getPointeeType(); 1018 if (PointeeTy->isArrayType()) { 1019 // Pointers to arrays are mangled like arrays. 1020 mangleExtraDimensions(T->getPointeeType()); 1021 } else if (PointeeTy->isFunctionType()) { 1022 // Function pointers are special. 1023 Out << '6'; 1024 mangleType(static_cast<const FunctionType *>(PointeeTy.getTypePtr()), 1025 NULL, false, false); 1026 } else { 1027 if (!PointeeTy.hasQualifiers()) 1028 // Lack of qualifiers is mangled as 'A'. 1029 Out << 'A'; 1030 mangleType(PointeeTy); 1031 } 1032} 1033void MicrosoftCXXNameMangler::mangleType(const ObjCObjectPointerType *T) { 1034 // Object pointers never have qualifiers. 1035 Out << 'A'; 1036 mangleType(T->getPointeeType()); 1037} 1038 1039// <type> ::= <reference-type> 1040// <reference-type> ::= A <cvr-qualifiers> <type> 1041void MicrosoftCXXNameMangler::mangleType(const LValueReferenceType *T) { 1042 Out << 'A'; 1043 QualType PointeeTy = T->getPointeeType(); 1044 if (!PointeeTy.hasQualifiers()) 1045 // Lack of qualifiers is mangled as 'A'. 1046 Out << 'A'; 1047 mangleType(PointeeTy); 1048} 1049 1050void MicrosoftCXXNameMangler::mangleType(const RValueReferenceType *T) { 1051 assert(false && "Don't know how to mangle RValueReferenceTypes yet!"); 1052} 1053 1054void MicrosoftCXXNameMangler::mangleType(const ComplexType *T) { 1055 assert(false && "Don't know how to mangle ComplexTypes yet!"); 1056} 1057 1058void MicrosoftCXXNameMangler::mangleType(const VectorType *T) { 1059 assert(false && "Don't know how to mangle VectorTypes yet!"); 1060} 1061void MicrosoftCXXNameMangler::mangleType(const ExtVectorType *T) { 1062 assert(false && "Don't know how to mangle ExtVectorTypes yet!"); 1063} 1064void MicrosoftCXXNameMangler::mangleType(const DependentSizedExtVectorType *T) { 1065 assert(false && "Don't know how to mangle DependentSizedExtVectorTypes yet!"); 1066} 1067 1068void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T) { 1069 // ObjC interfaces have structs underlying them. 1070 Out << 'U'; 1071 mangleName(T->getDecl()); 1072} 1073 1074void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T) { 1075 // We don't allow overloading by different protocol qualification, 1076 // so mangling them isn't necessary. 1077 mangleType(T->getBaseType()); 1078} 1079 1080void MicrosoftCXXNameMangler::mangleType(const BlockPointerType *T) { 1081 Out << "_E"; 1082 mangleType(T->getPointeeType()); 1083} 1084 1085void MicrosoftCXXNameMangler::mangleType(const InjectedClassNameType *T) { 1086 assert(false && "Don't know how to mangle InjectedClassNameTypes yet!"); 1087} 1088 1089void MicrosoftCXXNameMangler::mangleType(const TemplateSpecializationType *T) { 1090 assert(false && "Don't know how to mangle TemplateSpecializationTypes yet!"); 1091} 1092 1093void MicrosoftCXXNameMangler::mangleType(const DependentNameType *T) { 1094 assert(false && "Don't know how to mangle DependentNameTypes yet!"); 1095} 1096 1097void MicrosoftCXXNameMangler::mangleType( 1098 const DependentTemplateSpecializationType *T) { 1099 assert(false && 1100 "Don't know how to mangle DependentTemplateSpecializationTypes yet!"); 1101} 1102 1103void MicrosoftCXXNameMangler::mangleType(const PackExpansionType *T) { 1104 assert(false && "Don't know how to mangle PackExpansionTypes yet!"); 1105} 1106 1107void MicrosoftCXXNameMangler::mangleType(const TypeOfType *T) { 1108 assert(false && "Don't know how to mangle TypeOfTypes yet!"); 1109} 1110 1111void MicrosoftCXXNameMangler::mangleType(const TypeOfExprType *T) { 1112 assert(false && "Don't know how to mangle TypeOfExprTypes yet!"); 1113} 1114 1115void MicrosoftCXXNameMangler::mangleType(const DecltypeType *T) { 1116 assert(false && "Don't know how to mangle DecltypeTypes yet!"); 1117} 1118 1119void MicrosoftCXXNameMangler::mangleType(const AutoType *T) { 1120 assert(false && "Don't know how to mangle AutoTypes yet!"); 1121} 1122 1123void MicrosoftMangleContext::mangleName(const NamedDecl *D, 1124 llvm::raw_ostream &Out) { 1125 assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) && 1126 "Invalid mangleName() call, argument is not a variable or function!"); 1127 assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) && 1128 "Invalid mangleName() call on 'structor decl!"); 1129 1130 PrettyStackTraceDecl CrashInfo(D, SourceLocation(), 1131 getASTContext().getSourceManager(), 1132 "Mangling declaration"); 1133 1134 MicrosoftCXXNameMangler Mangler(*this, Out); 1135 return Mangler.mangle(D); 1136} 1137void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD, 1138 const ThunkInfo &Thunk, 1139 llvm::raw_ostream &) { 1140 assert(false && "Can't yet mangle thunks!"); 1141} 1142void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, 1143 CXXDtorType Type, 1144 const ThisAdjustment &, 1145 llvm::raw_ostream &) { 1146 assert(false && "Can't yet mangle destructor thunks!"); 1147} 1148void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD, 1149 llvm::raw_ostream &) { 1150 assert(false && "Can't yet mangle virtual tables!"); 1151} 1152void MicrosoftMangleContext::mangleCXXVTT(const CXXRecordDecl *RD, 1153 llvm::raw_ostream &) { 1154 llvm_unreachable("The MS C++ ABI does not have virtual table tables!"); 1155} 1156void MicrosoftMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD, 1157 int64_t Offset, 1158 const CXXRecordDecl *Type, 1159 llvm::raw_ostream &) { 1160 llvm_unreachable("The MS C++ ABI does not have constructor vtables!"); 1161} 1162void MicrosoftMangleContext::mangleCXXRTTI(QualType T, 1163 llvm::raw_ostream &) { 1164 assert(false && "Can't yet mangle RTTI!"); 1165} 1166void MicrosoftMangleContext::mangleCXXRTTIName(QualType T, 1167 llvm::raw_ostream &) { 1168 assert(false && "Can't yet mangle RTTI names!"); 1169} 1170void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D, 1171 CXXCtorType Type, 1172 llvm::raw_ostream &) { 1173 assert(false && "Can't yet mangle constructors!"); 1174} 1175void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D, 1176 CXXDtorType Type, 1177 llvm::raw_ostream &) { 1178 assert(false && "Can't yet mangle destructors!"); 1179} 1180void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *, 1181 llvm::raw_ostream &) { 1182 assert(false && "Can't yet mangle reference temporaries!"); 1183} 1184 1185MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context, 1186 Diagnostic &Diags) { 1187 return new MicrosoftMangleContext(Context, Diags); 1188} 1189