MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / demangler_one

Function demangler_one

inst/include/Rcpp/exceptions_impl.h:41–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 // Extract mangled name e.g. ./test(baz+0x14)[0x400962]
40#if RCPP_DEMANGLER_ENABLED
41 static inline std::string demangler_one(const char* input) { // #nocov start
42
43 static std::string buffer;
44
45 buffer = input;
46 size_t last_open = buffer.find_last_of('(');
47 size_t last_close = buffer.find_last_of(')');
48 if (last_open == std::string::npos ||
49 last_close == std::string::npos) {
50 return input; // #nocov
51 }
52 std::string function_name = buffer.substr(last_open + 1, last_close - last_open - 1);
53 // Strip the +0x14 (if it exists, which it does not in earlier versions of gcc)
54 size_t function_plus = function_name.find_last_of('+');
55 if (function_plus != std::string::npos) {
56 function_name.resize(function_plus);
57 }
58 buffer.replace(last_open + 1, function_name.size(), demangle(function_name));
59
60 return buffer;
61
62 }
63#endif
64
65 // thread-safe; invoked prior to throwing the exception

Callers

nothing calls this directly

Calls 3

demangleFunction · 0.85
replaceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected