简体   繁体   English

如何在clang(或gcc)中解码C ++名称?

[英]How to demangle a C++ name in clang (or gcc)?

I'm trying to write a quick-and-dirty demangler for clang. 我正在努力为clang编写一个快速而肮脏的demangler。 I've found a piece of code that uses abi::__cxa_demangle , but I can't figure out which header it requires. 我发现了一段使用abi::__cxa_demangle 的代码 ,但我无法弄清楚它需要哪个头。 The obvious choice is ABI.h but: 显而易见的选择是ABI.h但是:

demangle.cpp:2:10: fatal error: 'ABI.h' file not found
#include <ABI.h>
         ^

What do I need to use abi::__cxa_demangle ? 我需要使用abi::__cxa_demangle

Include cxxabi.h . 包括cxxabi.h In Ubuntu 13 this header is in /usr/include/c++/4.x where x is minor gcc version. 在Ubuntu 13中,这个头文件位于/usr/include/c++/4.x ,其中x是次要的gcc版本。

包括cxxabi.h,但是对于Ubuntu上的clang,你需要安装包libc ++ abi-dev。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM