Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
c338a2e8
Commit
c338a2e8
authored
Mar 13, 2014
by
Neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use smart pointer to store result of demangling
parent
e512567a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
src/demangle.cpp
src/demangle.cpp
+5
-3
No files found.
src/demangle.cpp
View file @
c338a2e8
...
@@ -44,7 +44,10 @@ namespace cppa { namespace detail {
...
@@ -44,7 +44,10 @@ namespace cppa { namespace detail {
std
::
string
demangle
(
const
char
*
decorated
)
{
std
::
string
demangle
(
const
char
*
decorated
)
{
size_t
size
;
size_t
size
;
int
status
;
int
status
;
char
*
undecorated
=
abi
::
__cxa_demangle
(
decorated
,
nullptr
,
&
size
,
&
status
);
std
::
unique_ptr
<
char
,
void
(
*
)(
void
*
)
>
undecorated
{
abi
::
__cxa_demangle
(
decorated
,
nullptr
,
&
size
,
&
status
),
std
::
free
};
if
(
status
!=
0
)
{
if
(
status
!=
0
)
{
std
::
string
error_msg
=
"Could not demangle type name "
;
std
::
string
error_msg
=
"Could not demangle type name "
;
error_msg
+=
decorated
;
error_msg
+=
decorated
;
...
@@ -52,7 +55,7 @@ std::string demangle(const char* decorated) {
...
@@ -52,7 +55,7 @@ std::string demangle(const char* decorated) {
}
}
std
::
string
result
;
// the undecorated typeid name
std
::
string
result
;
// the undecorated typeid name
result
.
reserve
(
size
);
result
.
reserve
(
size
);
const
char
*
cstr
=
undecorated
;
const
char
*
cstr
=
undecorated
.
get
()
;
// filter unnecessary characters from undecorated
// filter unnecessary characters from undecorated
char
c
=
*
cstr
;
char
c
=
*
cstr
;
while
(
c
!=
'\0'
)
{
while
(
c
!=
'\0'
)
{
...
@@ -78,7 +81,6 @@ std::string demangle(const char* decorated) {
...
@@ -78,7 +81,6 @@ std::string demangle(const char* decorated) {
c
=
*++
cstr
;
c
=
*++
cstr
;
}
}
}
}
free
(
undecorated
);
# ifdef CPPA_CLANG
# ifdef CPPA_CLANG
// replace "std::__1::" with "std::" (fixes strange clang names)
// replace "std::__1::" with "std::" (fixes strange clang names)
std
::
string
needle
=
"std::__1::"
;
std
::
string
needle
=
"std::__1::"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment