diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/Mangle.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/AST/Mangle.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/Mangle.cpp b/contrib/llvm-project/clang/lib/AST/Mangle.cpp index 30cff1ba2e6f..75f6e2161a63 100644 --- a/contrib/llvm-project/clang/lib/AST/Mangle.cpp +++ b/contrib/llvm-project/clang/lib/AST/Mangle.cpp @@ -301,9 +301,8 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD, } else { assert((isa<NamedDecl>(DC) || isa<BlockDecl>(DC)) && "expected a NamedDecl or BlockDecl"); - if (isa<BlockDecl>(DC)) - for (; DC && isa<BlockDecl>(DC); DC = DC->getParent()) - (void) getBlockId(cast<BlockDecl>(DC), true); + for (; isa_and_nonnull<BlockDecl>(DC); DC = DC->getParent()) + (void)getBlockId(cast<BlockDecl>(DC), true); assert((isa<TranslationUnitDecl>(DC) || isa<NamedDecl>(DC)) && "expected a TranslationUnitDecl or a NamedDecl"); if (const auto *CD = dyn_cast<CXXConstructorDecl>(DC)) @@ -514,10 +513,20 @@ public: } } else if (const auto *MD = dyn_cast_or_null<CXXMethodDecl>(ND)) { Manglings.emplace_back(getName(ND)); - if (MD->isVirtual()) - if (const auto *TIV = Ctx.getVTableContext()->getThunkInfo(MD)) - for (const auto &T : *TIV) - Manglings.emplace_back(getMangledThunk(MD, T)); + if (MD->isVirtual()) { + if (const auto *TIV = Ctx.getVTableContext()->getThunkInfo(MD)) { + for (const auto &T : *TIV) { + std::string ThunkName; + std::string ContextualizedName = + getMangledThunk(MD, T, /* ElideOverrideInfo */ false); + if (Ctx.useAbbreviatedThunkName(MD, ContextualizedName)) + ThunkName = getMangledThunk(MD, T, /* ElideOverrideInfo */ true); + else + ThunkName = ContextualizedName; + Manglings.emplace_back(ThunkName); + } + } + } } return Manglings; @@ -570,11 +579,12 @@ private: return BOS.str(); } - std::string getMangledThunk(const CXXMethodDecl *MD, const ThunkInfo &T) { + std::string getMangledThunk(const CXXMethodDecl *MD, const ThunkInfo &T, + bool ElideOverrideInfo) { std::string FrontendBuf; llvm::raw_string_ostream FOS(FrontendBuf); - MC->mangleThunk(MD, T, FOS); + MC->mangleThunk(MD, T, ElideOverrideInfo, FOS); std::string BackendBuf; llvm::raw_string_ostream BOS(BackendBuf); |