[all-commits] [llvm/llvm-project] 877594: [clang][NFC] Refactor `clang::Linkage` (#71049)

Vlad Serebrennikov via All-commits all-commits at lists.llvm.org
Thu Nov 2 09:57:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8775947633bf189e1847707932b1015f04640ea0
      https://github.com/llvm/llvm-project/commit/8775947633bf189e1847707932b1015f04640ea0
  Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
  Date:   2023-11-02 (Thu, 02 Nov 2023)

  Changed paths:
    M clang-tools-extra/clang-doc/Serialize.cpp
    M clang-tools-extra/clangd/Quality.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.cpp
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/Linkage.h
    M clang/include/clang/Basic/Visibility.h
    M clang/lib/AST/APValue.cpp
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/lib/Index/IndexSymbol.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaModule.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    M clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp
    M clang/tools/libclang/CIndex.cpp
    M clang/tools/libclang/CXIndexDataConsumer.cpp
    M clang/unittests/AST/DeclTest.cpp

  Log Message:
  -----------
  [clang][NFC] Refactor `clang::Linkage` (#71049)

This patch introduces a new enumerator `Invalid = 0`, shifting other enumerators by +1. Contrary to how it might sound, this actually affirms status quo of how this enum is stored in `clang::Decl`:
```
  /// If 0, we have not computed the linkage of this declaration.
  /// Otherwise, it is the linkage + 1.
  mutable unsigned CacheValidAndLinkage : 3;
```
This patch makes debuggers to not be mistaken about enumerator stored in this bit-field. It also converts `clang::Linkage` to a scoped enum.




More information about the All-commits mailing list