SWDEV-294764 - Trim spaces from demangled name before comparision

Change-Id: I6359c5c01f68be1bbe98d2f2e079ae9cb06709b0


[ROCm/clr commit: 221cf39d65]
Этот коммит содержится в:
Jatin Chaudhary
2021-07-13 03:00:55 -07:00
коммит произвёл Jatin Chaudhary
родитель 6ee2e39b4b
Коммит db604128a0
+18 -3
Просмотреть файл
@@ -346,23 +346,38 @@ hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog, const char* name_expressio
auto it = ProgramState::instance().nameExpresssion_.find(name_expression);
if (it == ProgramState::instance().nameExpresssion_.end()) {
return HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID;
return HIPRTC_RETURN(HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID);
}
std::string strippedName = it->second.first;
std::string strippedNameNoSpace = strippedName;
strippedNameNoSpace.erase(std::remove_if(strippedNameNoSpace.begin(),
strippedNameNoSpace.end(),
[](unsigned char c) {
return std::isspace(c);
}), strippedNameNoSpace.end());
std::vector<std::string> mangledNames;
if (!dev_program->getLoweredNames(&mangledNames)) {
HIPRTC_RETURN(HIPRTC_ERROR_COMPILATION);
}
for (auto &name : mangledNames) {
for (auto& name : mangledNames) {
std::string demangledName = handleMangledName(name);
if (demangledName == strippedName) {
demangledName.erase(std::remove_if(demangledName.begin(), demangledName.end(),
[](unsigned char c) { return std::isspace(c); }),
demangledName.end());
if (demangledName == strippedNameNoSpace) {
it->second.second.assign(name);
break;
}
}
// Return error if the added symbol is not in code
if (it->second.second.size() == 0) {
return HIPRTC_RETURN(HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID);
}
*loweredName = it->second.second.c_str();
HIPRTC_RETURN(HIPRTC_SUCCESS);