Home | History | Annotate | Download | only in proto
      1 syntax = "proto2";
      2 
      3 package abi_dump;
      4 
      5 message BasicTypeAbi {
      6   // The type's name. for eg : a record field's type.
      7   optional string name = 1;
      8   // Optional since templated types will not have this information.
      9   optional uint64 size = 2 [default = 0];
     10   optional uint32 alignment = 3 [default = 0];
     11 }
     12 
     13 enum AccessSpecifier {
     14   public_access = 1;
     15   private_access = 2;
     16   protected_access = 3;
     17 }
     18 
     19 message BasicNamedAndTypedDecl {
     20   optional BasicTypeAbi type_abi = 1;
     21   // The TypedDecl's name.
     22   optional string name = 2;
     23   optional AccessSpecifier access = 3;
     24   optional string linker_set_key = 4;
     25 }
     26 
     27 message FunctionDecl {
     28   optional BasicNamedAndTypedDecl basic_abi = 1;
     29   // Mangled name.
     30   optional string mangled_function_name = 2;
     31   optional string source_file = 3;
     32   repeated ParamDecl parameters = 4;
     33   optional TemplateInfo template_info = 5;
     34 }
     35 
     36 message ParamDecl {
     37   optional BasicNamedAndTypedDecl basic_abi = 1;
     38   optional bool default_arg = 2;
     39 }
     40 
     41 message RecordFieldDecl {
     42   // For future additions.
     43   optional BasicNamedAndTypedDecl basic_abi = 1;
     44 }
     45 
     46 message EnumFieldDecl {
     47   optional BasicNamedAndTypedDecl basic_abi = 1;
     48   optional int64 enum_field_value = 2; // assumption: fits int64
     49 }
     50 
     51 message TemplateInfo {
     52   repeated TemplateElement elements = 1;
     53 }
     54 
     55 message TemplateElement {
     56   optional BasicTemplateElementAbi basic_abi = 1;
     57   message BasicTemplateElementAbi {
     58     optional BasicTypeAbi type_abi = 1;
     59     optional string name = 2;
     60     optional string linker_set_key = 3;
     61   }
     62 }
     63 
     64 message CXXBaseSpecifier {
     65   optional BasicNamedAndTypedDecl basic_abi = 1;
     66   optional bool is_virtual = 2;
     67 }
     68 
     69 message VTableComponent {
     70   enum Kind {
     71     VCallOffset = 0;
     72     VBaseOffset = 1;
     73     OffsetToTop = 2;
     74     RTTI = 3;
     75     FunctionPointer = 4;
     76     CompleteDtorPointer = 5;
     77     DeletingDtorPointer = 6;
     78     UnusedFunctionPointer = 7;
     79   }
     80   optional Kind kind = 1;
     81   optional string mangled_component_name = 2 [default = ""];
     82   optional uint64 value = 3 [default = 0];
     83 }
     84 
     85 message VTableLayout {
     86   repeated VTableComponent vtable_components = 1;
     87 }
     88 
     89 message RecordDecl {
     90   optional BasicNamedAndTypedDecl basic_abi = 1;
     91   repeated RecordFieldDecl fields = 2;
     92   repeated CXXBaseSpecifier base_specifiers = 3;
     93   optional string source_file = 4;
     94   optional TemplateInfo template_info = 5;
     95   optional string mangled_record_name = 6;
     96   optional VTableLayout vtable_layout = 7;
     97 }
     98 
     99 message EnumDecl {
    100   optional BasicNamedAndTypedDecl basic_abi = 1;
    101   repeated EnumFieldDecl enum_fields = 2;
    102   optional string source_file = 3;
    103 }
    104 
    105 message GlobalVarDecl {
    106   optional BasicNamedAndTypedDecl basic_abi = 1;
    107   optional string source_file = 2;
    108 }
    109 
    110 message TranslationUnit {
    111   repeated RecordDecl records = 1;
    112   repeated FunctionDecl functions = 2;
    113   repeated EnumDecl enums = 3;
    114   repeated GlobalVarDecl global_vars = 4;
    115 }
    116