Skip to content

Commit 4e8cc7c

Browse files
committed
Update MSVCMacroRebuilding.cpp
1 parent b43c39a commit 4e8cc7c

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

llvm/lib/Transforms/IPO/MSVCMacroRebuilding.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,18 @@ bool MSVCMacroRebuildingPass::replace__FUNCTION__(std::string &RegexStr,
3232
// Replace the macro marker and file name in the original string with
3333
// the name of the function containing the instruction.
3434
std::string ReplacedStr =
35-
std::regex_replace(OriginalStr, std::regex(RegexStr), FunctionName.str());
35+
std::regex_replace(OriginalStr, std::regex(RegexStr),
36+
demangleGetFunctionName(FunctionName.str()));
3637

3738
// If the replaced string is the same as the original string, skip the
3839
// variable.
3940
if (ReplacedStr == OriginalStr)
4041
return false;
4142

42-
// Demangle the replaced string and extract the function name.
43-
std::string DemangledReplacedStr = demangle(ReplacedStr);
44-
size_t StartIndex = DemangledReplacedStr.find("(");
45-
if (StartIndex != std::string::npos) {
46-
size_t EndIndex = DemangledReplacedStr.rfind(" ", StartIndex);
47-
if (EndIndex != std::string::npos) {
48-
DemangledReplacedStr =
49-
DemangledReplacedStr.substr(EndIndex + 1, StartIndex - EndIndex - 1);
50-
}
51-
}
52-
5343
// Create a new constant data array containing the demangled function
5444
// name and set it as the initializer of the global variable.
55-
Constant *NewStr = ConstantDataArray::getString(GV.getParent()->getContext(),
56-
DemangledReplacedStr);
45+
Constant *NewStr =
46+
ConstantDataArray::getString(GV.getParent()->getContext(), ReplacedStr);
5747
GV.setInitializer(NewStr);
5848

5949
return true;

0 commit comments

Comments
 (0)