[llvm] r192925 - DIEHash: Add more things (and remove one character) from the COLLECT_ATTR macro

Eric Christopher echristo at gmail.com
Thu Oct 17 19:04:29 PDT 2013


Sweet thanks.

Easier to read this way too.

-eric

On Thu, Oct 17, 2013 at 3:14 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Thu Oct 17 17:14:08 2013
> New Revision: 192925
>
> URL: http://llvm.org/viewvc/llvm-project?rev=192925&view=rev
> Log:
> DIEHash: Add more things (and remove one character) from the COLLECT_ATTR macro
>
> Makes the uses more terse and requires that they use a semicolon at the
> end that helps editors indent proceeding lines correctly.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=192925&r1=192924&r2=192925&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Thu Oct 17 17:14:08 2013
> @@ -122,161 +122,65 @@ void DIEHash::collectAttributes(DIE *Die
>    const DIEAbbrev &Abbrevs = Die->getAbbrev();
>
>  #define COLLECT_ATTR(NAME)                                                     \
> -  Attrs.NAME.Val = Values[i];                                                  \
> -  Attrs.NAME.Desc = &Abbrevs.getData()[i];
> +  case dwarf::NAME:                                                            \
> +    Attrs.NAME.Val = Values[i];                                                \
> +    Attrs.NAME.Desc = &Abbrevs.getData()[i];                                   \
> +    break
>
>    for (size_t i = 0, e = Values.size(); i != e; ++i) {
>      DEBUG(dbgs() << "Attribute: "
>                   << dwarf::AttributeString(Abbrevs.getData()[i].getAttribute())
>                   << " added.\n");
>      switch (Abbrevs.getData()[i].getAttribute()) {
> -    case dwarf::DW_AT_name:
> -      COLLECT_ATTR(DW_AT_name);
> -      break;
> -    case dwarf::DW_AT_accessibility:
> -      COLLECT_ATTR(DW_AT_accessibility)
> -      break;
> -    case dwarf::DW_AT_address_class:
> -      COLLECT_ATTR(DW_AT_address_class)
> -      break;
> -    case dwarf::DW_AT_allocated:
> -      COLLECT_ATTR(DW_AT_allocated)
> -      break;
> -    case dwarf::DW_AT_artificial:
> -      COLLECT_ATTR(DW_AT_artificial)
> -      break;
> -    case dwarf::DW_AT_associated:
> -      COLLECT_ATTR(DW_AT_associated)
> -      break;
> -    case dwarf::DW_AT_binary_scale:
> -      COLLECT_ATTR(DW_AT_binary_scale)
> -      break;
> -    case dwarf::DW_AT_bit_offset:
> -      COLLECT_ATTR(DW_AT_bit_offset)
> -      break;
> -    case dwarf::DW_AT_bit_size:
> -      COLLECT_ATTR(DW_AT_bit_size)
> -      break;
> -    case dwarf::DW_AT_bit_stride:
> -      COLLECT_ATTR(DW_AT_bit_stride)
> -      break;
> -    case dwarf::DW_AT_byte_size:
> -      COLLECT_ATTR(DW_AT_byte_size)
> -      break;
> -    case dwarf::DW_AT_byte_stride:
> -      COLLECT_ATTR(DW_AT_byte_stride)
> -      break;
> -    case dwarf::DW_AT_const_expr:
> -      COLLECT_ATTR(DW_AT_const_expr)
> -      break;
> -    case dwarf::DW_AT_const_value:
> -      COLLECT_ATTR(DW_AT_const_value)
> -      break;
> -    case dwarf::DW_AT_containing_type:
> -      COLLECT_ATTR(DW_AT_containing_type)
> -      break;
> -    case dwarf::DW_AT_count:
> -      COLLECT_ATTR(DW_AT_count)
> -      break;
> -    case dwarf::DW_AT_data_bit_offset:
> -      COLLECT_ATTR(DW_AT_data_bit_offset)
> -      break;
> -    case dwarf::DW_AT_data_location:
> -      COLLECT_ATTR(DW_AT_data_location)
> -      break;
> -    case dwarf::DW_AT_data_member_location:
> -      COLLECT_ATTR(DW_AT_data_member_location)
> -      break;
> -    case dwarf::DW_AT_decimal_scale:
> -      COLLECT_ATTR(DW_AT_decimal_scale)
> -      break;
> -    case dwarf::DW_AT_decimal_sign:
> -      COLLECT_ATTR(DW_AT_decimal_sign)
> -      break;
> -    case dwarf::DW_AT_default_value:
> -      COLLECT_ATTR(DW_AT_default_value)
> -      break;
> -    case dwarf::DW_AT_digit_count:
> -      COLLECT_ATTR(DW_AT_digit_count)
> -      break;
> -    case dwarf::DW_AT_discr:
> -      COLLECT_ATTR(DW_AT_discr)
> -      break;
> -    case dwarf::DW_AT_discr_list:
> -      COLLECT_ATTR(DW_AT_discr_list)
> -      break;
> -    case dwarf::DW_AT_discr_value:
> -      COLLECT_ATTR(DW_AT_discr_value)
> -      break;
> -    case dwarf::DW_AT_encoding:
> -      COLLECT_ATTR(DW_AT_encoding)
> -      break;
> -    case dwarf::DW_AT_enum_class:
> -      COLLECT_ATTR(DW_AT_enum_class)
> -      break;
> -    case dwarf::DW_AT_endianity:
> -      COLLECT_ATTR(DW_AT_endianity)
> -      break;
> -    case dwarf::DW_AT_explicit:
> -      COLLECT_ATTR(DW_AT_explicit)
> -      break;
> -    case dwarf::DW_AT_is_optional:
> -      COLLECT_ATTR(DW_AT_is_optional)
> -      break;
> -    case dwarf::DW_AT_location:
> -      COLLECT_ATTR(DW_AT_location)
> -      break;
> -    case dwarf::DW_AT_lower_bound:
> -      COLLECT_ATTR(DW_AT_lower_bound)
> -      break;
> -    case dwarf::DW_AT_mutable:
> -      COLLECT_ATTR(DW_AT_mutable)
> -      break;
> -    case dwarf::DW_AT_ordering:
> -      COLLECT_ATTR(DW_AT_ordering)
> -      break;
> -    case dwarf::DW_AT_picture_string:
> -      COLLECT_ATTR(DW_AT_picture_string)
> -      break;
> -    case dwarf::DW_AT_prototyped:
> -      COLLECT_ATTR(DW_AT_prototyped)
> -      break;
> -    case dwarf::DW_AT_small:
> -      COLLECT_ATTR(DW_AT_small)
> -      break;
> -    case dwarf::DW_AT_segment:
> -      COLLECT_ATTR(DW_AT_segment)
> -      break;
> -    case dwarf::DW_AT_string_length:
> -      COLLECT_ATTR(DW_AT_string_length)
> -      break;
> -    case dwarf::DW_AT_threads_scaled:
> -      COLLECT_ATTR(DW_AT_threads_scaled)
> -      break;
> -    case dwarf::DW_AT_upper_bound:
> -      COLLECT_ATTR(DW_AT_upper_bound)
> -      break;
> -    case dwarf::DW_AT_use_location:
> -      COLLECT_ATTR(DW_AT_use_location)
> -      break;
> -    case dwarf::DW_AT_use_UTF8:
> -      COLLECT_ATTR(DW_AT_use_UTF8)
> -      break;
> -    case dwarf::DW_AT_variable_parameter:
> -      COLLECT_ATTR(DW_AT_variable_parameter)
> -      break;
> -    case dwarf::DW_AT_virtuality:
> -      COLLECT_ATTR(DW_AT_virtuality)
> -      break;
> -    case dwarf::DW_AT_visibility:
> -      COLLECT_ATTR(DW_AT_visibility)
> -      break;
> -    case dwarf::DW_AT_vtable_elem_location:
> -      COLLECT_ATTR(DW_AT_vtable_elem_location)
> -      break;
> -    case dwarf::DW_AT_type:
> -      COLLECT_ATTR(DW_AT_type)
> -      break;
> +    COLLECT_ATTR(DW_AT_name);
> +    COLLECT_ATTR(DW_AT_accessibility);
> +    COLLECT_ATTR(DW_AT_address_class);
> +    COLLECT_ATTR(DW_AT_allocated);
> +    COLLECT_ATTR(DW_AT_artificial);
> +    COLLECT_ATTR(DW_AT_associated);
> +    COLLECT_ATTR(DW_AT_binary_scale);
> +    COLLECT_ATTR(DW_AT_bit_offset);
> +    COLLECT_ATTR(DW_AT_bit_size);
> +    COLLECT_ATTR(DW_AT_bit_stride);
> +    COLLECT_ATTR(DW_AT_byte_size);
> +    COLLECT_ATTR(DW_AT_byte_stride);
> +    COLLECT_ATTR(DW_AT_const_expr);
> +    COLLECT_ATTR(DW_AT_const_value);
> +    COLLECT_ATTR(DW_AT_containing_type);
> +    COLLECT_ATTR(DW_AT_count);
> +    COLLECT_ATTR(DW_AT_data_bit_offset);
> +    COLLECT_ATTR(DW_AT_data_location);
> +    COLLECT_ATTR(DW_AT_data_member_location);
> +    COLLECT_ATTR(DW_AT_decimal_scale);
> +    COLLECT_ATTR(DW_AT_decimal_sign);
> +    COLLECT_ATTR(DW_AT_default_value);
> +    COLLECT_ATTR(DW_AT_digit_count);
> +    COLLECT_ATTR(DW_AT_discr);
> +    COLLECT_ATTR(DW_AT_discr_list);
> +    COLLECT_ATTR(DW_AT_discr_value);
> +    COLLECT_ATTR(DW_AT_encoding);
> +    COLLECT_ATTR(DW_AT_enum_class);
> +    COLLECT_ATTR(DW_AT_endianity);
> +    COLLECT_ATTR(DW_AT_explicit);
> +    COLLECT_ATTR(DW_AT_is_optional);
> +    COLLECT_ATTR(DW_AT_location);
> +    COLLECT_ATTR(DW_AT_lower_bound);
> +    COLLECT_ATTR(DW_AT_mutable);
> +    COLLECT_ATTR(DW_AT_ordering);
> +    COLLECT_ATTR(DW_AT_picture_string);
> +    COLLECT_ATTR(DW_AT_prototyped);
> +    COLLECT_ATTR(DW_AT_small);
> +    COLLECT_ATTR(DW_AT_segment);
> +    COLLECT_ATTR(DW_AT_string_length);
> +    COLLECT_ATTR(DW_AT_threads_scaled);
> +    COLLECT_ATTR(DW_AT_upper_bound);
> +    COLLECT_ATTR(DW_AT_use_location);
> +    COLLECT_ATTR(DW_AT_use_UTF8);
> +    COLLECT_ATTR(DW_AT_variable_parameter);
> +    COLLECT_ATTR(DW_AT_virtuality);
> +    COLLECT_ATTR(DW_AT_visibility);
> +    COLLECT_ATTR(DW_AT_vtable_elem_location);
> +    COLLECT_ATTR(DW_AT_type);
>      default:
>        break;
>      }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list