@@ -32,28 +32,18 @@ bool MSVCMacroRebuildingPass::replace__FUNCTION__(std::string &RegexStr,
32
32
// Replace the macro marker and file name in the original string with
33
33
// the name of the function containing the instruction.
34
34
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 ()));
36
37
37
38
// If the replaced string is the same as the original string, skip the
38
39
// variable.
39
40
if (ReplacedStr == OriginalStr)
40
41
return false ;
41
42
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
-
53
43
// Create a new constant data array containing the demangled function
54
44
// 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 );
57
47
GV.setInitializer (NewStr);
58
48
59
49
return true ;
0 commit comments