[all-commits] [llvm/llvm-project] c1e08f: [clang][AST] Get rid of an alignment hack in DeclO...

Mikhail Maltsev via All-commits all-commits at lists.llvm.org
Tue Jan 12 02:23:02 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1e08f0073e35cf17c0a0343cf7efff914dbd66d
      https://github.com/llvm/llvm-project/commit/c1e08f0073e35cf17c0a0343cf7efff914dbd66d
  Author: Mikhail Maltsev <mikhail.maltsev at arm.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M clang/include/clang/AST/DeclObjC.h
    M clang/lib/AST/DeclObjC.cpp

  Log Message:
  -----------
  [clang][AST] Get rid of an alignment hack in DeclObjC.h [NFCI]

This code currently uses a union object to increase the
alignment of the type ObjCTypeParamList. The original intent of this
trick was to be able to use the expression `this + 1` to access the
beginning of a tail-allocated array of `ObjCTypeParamDecl *` pointers.

The code has since been refactored and uses `llvm::TrailingObjects` to
manage the tail-allocated array. This template takes care of
alignment, so the hack is no longer necessary.

This patch removes the union so that the `SourceRange` class can be
used directly instead of being re-implemented with raw representations
of source locations.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D94224




More information about the All-commits mailing list