Skip to content

Commit

Permalink
#2166: demangling: write work-around for Intel compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jun 14, 2023
1 parent 6109deb commit 553fdb0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/vt/utils/demangle/demangle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,28 @@ TemplateExtract::singlePfType(std::string const& pf) {

/*static*/ std::string
TemplateExtract::lastNamedPfType(std::string const& pf, std::string const& tparam) {
#if defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_COMPILER)
// For Intel, we have a different format to parse (we can't just
// look for 'TPARAM = '

// PF -> .. [T1 = .., T2 = .., void (*TPARAM)(...) = (...)]
std::string seek = tparam;

size_t i = pf.find(seek);
if (i == std::string::npos)
return "";
i = i + seek.length();

auto after_pf = pf.substr(i, pf.length() - i);

seek = " = ";
i = after_pf.find(seek);
if (i == std::string::npos)
return "";
i = i + seek.length();

return after_pf.substr(i, after_pf.length() - i - 1);
#else
// PF -> .. [T1 = .., T2 = .., TPARAM = (...)]
std::string seek = tparam + " = ";

Expand All @@ -77,6 +99,7 @@ TemplateExtract::lastNamedPfType(std::string const& pf, std::string const& tpara
i = i + seek.length();

return pf.substr(i, pf.length() - i - 1);
#endif
}

// Given a::b or a::b<c::d> or a<>::b<c>, eg. determines the
Expand Down

0 comments on commit 553fdb0

Please sign in to comment.