[all-commits] [llvm/llvm-project] 383cfe: [clang] Move ParsedAttrInfo from Sema to Basic (NFC)

Anders Waldenborg via All-commits all-commits at lists.llvm.org
Mon Mar 13 08:48:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 383cfeee09d1f345d08f396f2b7295b36830c88e
      https://github.com/llvm/llvm-project/commit/383cfeee09d1f345d08f396f2b7295b36830c88e
  Author: Anders Waldenborg <anders at 0x63.nu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    A clang/include/clang/Basic/ParsedAttrInfo.h
    M clang/include/clang/Sema/ParsedAttr.h
    M clang/lib/Basic/CMakeLists.txt
    A clang/lib/Basic/ParsedAttrInfo.cpp
    M clang/lib/Sema/ParsedAttr.cpp

  Log Message:
  -----------
  [clang] Move ParsedAttrInfo from Sema to Basic (NFC)

This moves the ParsedAttrInfo class and the registry for attribute
plugin to be part of Basic module instead of Sema module.

This will allow it to be accessed from preprocessor later on.

No functional change intended.

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


  Commit: f5f1813defb5810223de8f916380808a8ed34584
      https://github.com/llvm/llvm-project/commit/f5f1813defb5810223de8f916380808a8ed34584
  Author: Anders Waldenborg <anders at 0x63.nu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

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

  Log Message:
  -----------
  [clang] Extract attribute plugin instantiation to function (NFC)

This moves the code to instantiate the attribute plugins to the same
place where the plugin registry is defined so they live together and the
user of the plugins doesn't have the burden of instantiating the
plugins.

No functional change intended.

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


  Commit: 446f78092ffa75274866ec40411a1c0dbec2f13d
      https://github.com/llvm/llvm-project/commit/446f78092ffa75274866ec40411a1c0dbec2f13d
  Author: Anders Waldenborg <anders at 0x63.nu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

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

  Log Message:
  -----------
  [clang] Extract ParsedAttrInfo::hasSpelling method (NFC)

This intends to simplify this checking when it is done in more places.

No functional change intended.

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


  Commit: 8629343a8b6c26f15f02de2fdd8db440eba71937
      https://github.com/llvm/llvm-project/commit/8629343a8b6c26f15f02de2fdd8db440eba71937
  Author: Anders Waldenborg <anders at 0x63.nu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    M clang/lib/Basic/Attributes.cpp

  Log Message:
  -----------
  [clang] Extract function for generated part of clang::hasAttribute (NFC)

This makes it easier to add additional handling when the
tablegen-generated code does not find a match.

No functional change intended.

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


  Commit: 1285a495d5886b99f8d193c90b258a56f89c8937
      https://github.com/llvm/llvm-project/commit/1285a495d5886b99f8d193c90b258a56f89c8937
  Author: Anders Waldenborg <anders at 0x63.nu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/examples/Attribute/Attribute.cpp
    M clang/lib/Basic/Attributes.cpp
    A clang/test/Frontend/plugin-attribute-pp.cpp

  Log Message:
  -----------
  [clang][pp] Handle attributes defined by plugin in __has_attribute

When using attributes by plugins (both in clang and clang-tidy) the
preprocessor functions `__has_attribute`, `__has_c_attribute`,
`__has_cpp_attribute` still returned 0.

That problem is fixed by having the "hasAttribute" function also check
if any of the plugins provide that attribute.

This also adds C2x spelling to the example plugin for attributes so that
`__has_c_attribute` can be tested.

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


Compare: https://github.com/llvm/llvm-project/compare/21bca796d7f0...1285a495d588


More information about the All-commits mailing list