Lines Matching +full:dc +full:- +full:id

1 //===--- Mangle.cpp - Mangle C++ Names --------------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Implements generic name mangling support for blocks and Objective-C.
11 //===----------------------------------------------------------------------===//
60 return FD->isExternC(); in isExternC()
62 return VD->isExternC(); in isExternC()
75 if (FD->isMain() && FD->getNumParams() == 2) in getCallingConvMangling()
88 QualType T = FD->getType(); in getCallingConvMangling()
90 const FunctionType *FT = T->castAs<FunctionType>(); in getCallingConvMangling()
92 CallingConv CC = FT->getCallConv(); in getCallingConvMangling()
114 if (!D->hasExternalFormalLinkage() && D->getOwningModuleForLinkage()) in shouldMangleDeclName()
118 // -funique-internal-linkage-names. in shouldMangleDeclName()
124 if (!getASTContext().getLangOpts().CPlusPlus && !D->hasAttrs()) in shouldMangleDeclName()
129 if (D->hasAttr<AsmLabelAttr>()) in shouldMangleDeclName()
145 if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) { in mangleName()
150 if (!ALA->getIsLiteralLabel() || ALA->getLabel().starts_with("llvm.")) { in mangleName()
151 Out << ALA->getLabel(); in mangleName()
172 Out << ALA->getLabel(); in mangleName()
209 Out << D->getIdentifier()->getName(); in mangleName()
216 const FunctionType *FT = FD->getType()->castAs<FunctionType>(); in mangleName()
225 assert(!Proto->isVariadic()); in mangleName()
228 if (MD->isImplicitObjectMemberFunction()) in mangleName()
231 for (const auto &AT : Proto->param_types()) { in mangleName()
235 if (AT->isIncompleteType()) in mangleName()
247 MSGuidDecl::Parts P = GD->getParts(); in mangleMSGuidDecl()
259 const NamedDecl *ID, in mangleGlobalBlock() argument
262 if (ID) { in mangleGlobalBlock()
263 if (shouldMangleDeclName(ID)) in mangleGlobalBlock()
264 mangleName(ID, Out); in mangleGlobalBlock()
266 Out << ID->getIdentifier()->getName(); in mangleGlobalBlock()
293 void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD, in mangleBlock() argument
295 assert(!isa<CXXConstructorDecl>(DC) && !isa<CXXDestructorDecl>(DC)); in mangleBlock()
299 if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC)) { in mangleBlock()
302 assert((isa<NamedDecl>(DC) || isa<BlockDecl>(DC)) && in mangleBlock()
304 for (; isa_and_nonnull<BlockDecl>(DC); DC = DC->getParent()) in mangleBlock()
305 (void)getBlockId(cast<BlockDecl>(DC), true); in mangleBlock()
306 assert((isa<TranslationUnitDecl>(DC) || isa<NamedDecl>(DC)) && in mangleBlock()
308 if (const auto *CD = dyn_cast<CXXConstructorDecl>(DC)) in mangleBlock()
310 else if (const auto *DD = dyn_cast<CXXDestructorDecl>(DC)) in mangleBlock()
312 else if (auto ND = dyn_cast<NamedDecl>(DC)) { in mangleBlock()
313 if (!shouldMangleDeclName(ND) && ND->getIdentifier()) in mangleBlock()
314 Stream << ND->getIdentifier()->getName(); in mangleBlock()
337 OS << (MD->isClassMethod() ? "_c_" : "_i_") in mangleObjCMethodName()
338 << MD->getClassInterface()->getName() << '_'; in mangleObjCMethodName()
341 if (auto category = MD->getCategory()) in mangleObjCMethodName()
342 OS << category->getName(); in mangleObjCMethodName()
346 auto selector = MD->getSelector(); in mangleObjCMethodName()
352 OS << name->getName(); in mangleObjCMethodName()
368 OS << (MD->isInstanceMethod() ? '-' : '+') << '['; in mangleObjCMethodName()
369 if (const auto *CID = MD->getCategory()) { in mangleObjCMethodName()
370 OS << CID->getClassInterface()->getName(); in mangleObjCMethodName()
375 dyn_cast<ObjCContainerDecl>(MD->getDeclContext())) { in mangleObjCMethodName()
376 OS << CD->getName(); in mangleObjCMethodName()
381 MD->getSelector().print(OS); in mangleObjCMethodName()
409 if (FD->isDependentContext()) in writeName()
417 MC->mangleObjCMethodName(MD, OS, /*includePrefixByte=*/false, in writeName()
420 } else if (auto *ID = dyn_cast<ObjCInterfaceDecl>(D)) { in writeName() local
421 writeObjCClassName(ID, FrontendBufOS); in writeName()
455 ClassName = OID->getObjCRuntimeNameAsString(); in getAllManglings()
457 ClassName = OID->getObjCRuntimeNameAsString(); in getAllManglings()
462 auto Mangle = [&](ObjCKind Kind, StringRef ClassName) -> std::string { in getAllManglings()
464 auto Prefix = getClassSymbolPrefix(Kind, OCD->getASTContext()); in getAllManglings()
484 ASTContext &Ctx = ND->getASTContext(); in getAllManglings()
492 auto CC = MD->getType()->castAs<FunctionProtoType>()->getCallConv(); in getAllManglings()
500 if (!CD->getParent()->isAbstract()) in getAllManglings()
504 if (CD->hasAttr<DLLExportAttr>() && CD->isDefaultConstructor()) in getAllManglings()
505 if (!(hasDefaultCXXMethodCC(Ctx, CD) && CD->getNumParams() == 0)) in getAllManglings()
511 if (DD->isVirtual()) in getAllManglings()
516 if (MD->isVirtual()) { in getAllManglings()
517 if (const auto *TIV = Ctx.getVTableContext()->getThunkInfo(MD)) { in getAllManglings()
537 if (MC->shouldMangleDeclName(D)) { in writeFuncOrVarName()
543 else if (D->hasAttr<CUDAGlobalAttr>()) in writeFuncOrVarName()
547 MC->mangleName(GD, OS); in writeFuncOrVarName()
550 IdentifierInfo *II = D->getIdentifier(); in writeFuncOrVarName()
553 OS << II->getName(); in writeFuncOrVarName()
559 OS << getClassSymbolPrefix(ObjCClass, D->getASTContext()); in writeObjCClassName()
560 OS << D->getObjCRuntimeNameAsString(); in writeObjCClassName()
572 MC->mangleName(GD, FOS); in getMangledStructor()
587 MC->mangleThunk(MD, T, ElideOverrideInfo, FOS); in getMangledThunk()
604 return Impl->writeName(D, OS); in writeName()
608 return Impl->getName(D); in getName()
612 return Impl->getAllManglings(D); in getAllManglings()