STLs may be in std::__cxx11 namespace

When we parse header files and find std::basic_string we change that to std::string.
Added a check for std::__cxx11::basic_string to do the same.  We also carry a
list of STL names, added std::__cxx11::[template_name] to the list of possilbe STL
names we are searching for.

refs #214
This commit is contained in:
Alex Lin 2016-04-01 21:35:53 -04:00
parent fb8a5f1d1d
commit 0b7e3e2dc9
2 changed files with 16 additions and 2 deletions

View File

@ -317,6 +317,17 @@ static std::map<std::string, bool> init_stl_classes() {
my_map.insert(std::pair<std::string, bool>("std::__1::set", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__1::stack", 0)) ;
my_map.insert(std::pair<std::string, bool>("std::__1::vector", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::deque", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::list", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::map", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::multiset", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::multimap", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::pair", 0)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::priority_queue", 0)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::queue", 0)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::set", 1)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::stack", 0)) ;
my_map.insert(std::pair<std::string, bool>("std::__cxx11::vector", 1)) ;
return my_map ;
}
@ -331,7 +342,8 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
The attributes type is set to TRICK_STRING instead of TRICK_STRUCTURE.
The type is set to std::string. We can return false here to stop processing of this type. */
std::string type_name = rt->getDecl()->getQualifiedNameAsString() ;
if ( ! type_name.compare("std::basic_string") || !type_name.compare("std::__1::basic_string")) {
if ( ! type_name.compare("std::basic_string") || !type_name.compare("std::__1::basic_string") ||
! type_name.compare("std::__cxx11::basic_string") ) {
fdes->setEnumString("TRICK_STRING") ;
fdes->setTypeName("std::string") ;
return false ;

View File

@ -4,7 +4,9 @@
std::string stl_type_name_convert(std::string in_type) {
std::string type_string(in_type) ;
std::string basic_string("std::__1::basic_string") ;
if ( !type_string.compare(0, basic_string.length(), basic_string)) {
std::string cxx11_string("std::__cxx11::basic_string") ;
if ( !type_string.compare(0, basic_string.length(), basic_string) ||
!type_string.compare(0, cxx11_string.length(), cxx11_string)) {
type_string = "std::string" ;
}
return type_string ;