@@ -3039,95 +3039,6 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE(
3039
3039
return type_sp;
3040
3040
}
3041
3041
3042
- // This function helps to ensure that the declaration contexts match for two
3043
- // different DIEs. Often times debug information will refer to a forward
3044
- // declaration of a type (the equivalent of "struct my_struct;". There will
3045
- // often be a declaration of that type elsewhere that has the full definition.
3046
- // When we go looking for the full type "my_struct", we will find one or more
3047
- // matches in the accelerator tables and we will then need to make sure the
3048
- // type was in the same declaration context as the original DIE. This function
3049
- // can efficiently compare two DIEs and will return true when the declaration
3050
- // context matches, and false when they don't.
3051
- bool SymbolFileDWARF::DIEDeclContextsMatch (const DWARFDIE &die1,
3052
- const DWARFDIE &die2) {
3053
- if (die1 == die2)
3054
- return true ;
3055
-
3056
- std::vector<DWARFDIE> decl_ctx_1;
3057
- std::vector<DWARFDIE> decl_ctx_2;
3058
- // The declaration DIE stack is a stack of the declaration context DIEs all
3059
- // the way back to the compile unit. If a type "T" is declared inside a class
3060
- // "B", and class "B" is declared inside a class "A" and class "A" is in a
3061
- // namespace "lldb", and the namespace is in a compile unit, there will be a
3062
- // stack of DIEs:
3063
- //
3064
- // [0] DW_TAG_class_type for "B"
3065
- // [1] DW_TAG_class_type for "A"
3066
- // [2] DW_TAG_namespace for "lldb"
3067
- // [3] DW_TAG_compile_unit or DW_TAG_partial_unit for the source file.
3068
- //
3069
- // We grab both contexts and make sure that everything matches all the way
3070
- // back to the compiler unit.
3071
-
3072
- // First lets grab the decl contexts for both DIEs
3073
- decl_ctx_1 = die1.GetDeclContextDIEs ();
3074
- decl_ctx_2 = die2.GetDeclContextDIEs ();
3075
- // Make sure the context arrays have the same size, otherwise we are done
3076
- const size_t count1 = decl_ctx_1.size ();
3077
- const size_t count2 = decl_ctx_2.size ();
3078
- if (count1 != count2)
3079
- return false ;
3080
-
3081
- // Make sure the DW_TAG values match all the way back up the compile unit. If
3082
- // they don't, then we are done.
3083
- DWARFDIE decl_ctx_die1;
3084
- DWARFDIE decl_ctx_die2;
3085
- size_t i;
3086
- for (i = 0 ; i < count1; i++) {
3087
- decl_ctx_die1 = decl_ctx_1[i];
3088
- decl_ctx_die2 = decl_ctx_2[i];
3089
- if (decl_ctx_die1.Tag () != decl_ctx_die2.Tag ())
3090
- return false ;
3091
- }
3092
- #ifndef NDEBUG
3093
-
3094
- // Make sure the top item in the decl context die array is always
3095
- // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then
3096
- // something went wrong in the DWARFDIE::GetDeclContextDIEs()
3097
- // function.
3098
- dw_tag_t cu_tag = decl_ctx_1[count1 - 1 ].Tag ();
3099
- UNUSED_IF_ASSERT_DISABLED (cu_tag);
3100
- assert (cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit);
3101
-
3102
- #endif
3103
- // Always skip the compile unit when comparing by only iterating up to "count
3104
- // - 1". Here we compare the names as we go.
3105
- for (i = 0 ; i < count1 - 1 ; i++) {
3106
- decl_ctx_die1 = decl_ctx_1[i];
3107
- decl_ctx_die2 = decl_ctx_2[i];
3108
- const char *name1 = decl_ctx_die1.GetName ();
3109
- const char *name2 = decl_ctx_die2.GetName ();
3110
- // If the string was from a DW_FORM_strp, then the pointer will often be
3111
- // the same!
3112
- if (name1 == name2)
3113
- continue ;
3114
-
3115
- // Name pointers are not equal, so only compare the strings if both are not
3116
- // NULL.
3117
- if (name1 && name2) {
3118
- // If the strings don't compare, we are done...
3119
- if (strcmp (name1, name2) != 0 )
3120
- return false ;
3121
- } else {
3122
- // One name was NULL while the other wasn't
3123
- return false ;
3124
- }
3125
- }
3126
- // We made it through all of the checks and the declaration contexts are
3127
- // equal.
3128
- return true ;
3129
- }
3130
-
3131
3042
TypeSP
3132
3043
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (const DWARFDIE &die) {
3133
3044
TypeSP type_sp;
0 commit comments