[all-commits] [llvm/llvm-project] ac74d9: [clang][NFC] Regroup declarations in `Sema` (#82217)

Vlad Serebrennikov via All-commits all-commits at lists.llvm.org
Wed Mar 6 02:39:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ac74d9ec0f73898713dd6e0d33f148c13a51875d
      https://github.com/llvm/llvm-project/commit/ac74d9ec0f73898713dd6e0d33f148c13a51875d
  Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/Sema.cpp

  Log Message:
  -----------
  [clang][NFC] Regroup declarations in `Sema` (#82217)

This patch regroups declarations in `Sema` based on the file they are
implemented in (e.g. `SemaChecking.cpp`). This allows to logically split
`Sema` in 42 groups. No physical separation is done (e.g. splitting
`Sema` into multiple classes). Table of contents added at the very
beginning of `Sema`. Grouping is reflected in Doxygen commands, so
structure of API reference of `Sema` is also significantly improved
([example from official
documentation](https://www.doxygen.nl/manual/examples/memgrp/html/class_memgrp___test.html),
[comparison of Sema API
reference](https://github.com/llvm/llvm-project/pull/82217#issuecomment-1954567763)).

While grouping is intentional, as well as each group consisting of
`public` declarations followed by `private` ones (without changing
access in-between), exact contents and order of declarations of each
group is partially carried over from old structure, partially accidental
due to time constrains to do the regrouping over the weekend (`Sema` is
just enormously big). Data members and inline function definitions in
`Sema.h` complicate the matter, since it's not obvious which group they
belong to. Further work is expected to refine contents and order of
declarations.

What is also intentional is some kind of layering, where Concepts group
follows template groups, and ObjC, code completion, CUDA, HLSL, OpenACC,
OpenMP, and SYCL are all placed at the end of the file, after C and C++
parts of `Sema`.

I used `clang-query` to verify that access specifiers were preserved
during the process (https://gcc.godbolt.org/z/9johffY9T, thank you
@ilya-biryukov). Only the following 3 member types were converted from
`private` to `public` because of limitations of the new grouping:
`DeclareTargetContextInfo`, `TypoExprState`, `SatisfactionStackEntryTy`.

Member initializer list of `Sema` in `Sema.cpp` is rewritten to reflect
new order of data members in order to avoid `-Wreorder-ctor`.

Since this patch touches almost every line in `Sema.h`, it was
considered appropriate to run clang-format on the whole file, and not
just on changed lines.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list