[cfe-dev] How to interpret the types when compiling STL list

Xiaolong Tang xiaolong.snake at gmail.com
Tue Jul 27 06:01:50 PDT 2010


Hey all, 

Given a program using the STL list, Clang emits the following type
information:

  %"class.__gnu_cxx::new_allocator" = type { i8 }
  %"class.std::_List_base" = type { %"struct.std::_List_base<int, std::allocator<int> >::_List_impl" }
  %"class.std::allocator" = type { i8 }
  %"class.std::list" = type { [16 x i8] }
  %"struct.std::_List_base<int, std::allocator<int> >::_List_impl" = type { %"struct.std::_List_node_base" }
  %"struct.std::_List_const_iterator" = type { %"struct.std::_List_node_base"* }
  %"struct.std::_List_iterator" = type { %"struct.std::_List_node_base"* }
  %"struct.std::_List_node" = type { [16 x i8], i32, [4 x i8] }
  %"struct.std::_List_node_base" = type { %"struct.std::_List_node_base"*, %"struct.std::_List_node_base"* }
  %"struct.std::__false_type" = type { i8 }

Amongst the types, %"struct.std::_List_node" and %"class.std::list"
are not nature to me. My questions are:
  - Why do the two types have no corresponding type arguments? And
    roughly how are they computed?
  - Is this unique to Clang? Can I have control on how Clang handles
    these types? E.g. something like this:

  %"struct.std::list<int,std::allocator<int> >" = type { %"struct.std::_List_base<int,std::allocator<int> >" }
  %"struct.std::_List_node<int>" = type { %"struct.std::_List_node_base", i32 }

Best, 
Xiaolong



More information about the cfe-dev mailing list