diff options
author | Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> | 2023-11-02 20:57:29 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 20:57:29 +0400 |
commit | 8775947633bf189e1847707932b1015f04640ea0 (patch) | |
tree | 44e121ebf486cda5de36737d228ed9380d160d7c /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 8a3e4b5f32e6d333b6fa70aa6c505046ce18630f (diff) | |
download | llvm-8775947633bf189e1847707932b1015f04640ea0.zip llvm-8775947633bf189e1847707932b1015f04640ea0.tar.gz llvm-8775947633bf189e1847707932b1015f04640ea0.tar.bz2 |
[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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cc81a68..35f651b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3997,7 +3997,7 @@ TargetMVPriority(const TargetInfo &TI, llvm::GlobalValue::LinkageTypes getMultiversionLinkage(CodeGenModule &CGM, GlobalDecl GD) { const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl()); - if (FD->getFormalLinkage() == InternalLinkage) + if (FD->getFormalLinkage() == Linkage::Internal) return llvm::GlobalValue::InternalLinkage; return llvm::GlobalValue::WeakODRLinkage; } @@ -5051,7 +5051,7 @@ void CodeGenModule::MaybeHandleStaticInExternC(const SomeDecl *D, return; // Must have internal linkage and an ordinary name. - if (!D->getIdentifier() || D->getFormalLinkage() != InternalLinkage) + if (!D->getIdentifier() || D->getFormalLinkage() != Linkage::Internal) return; // Must be in an extern "C" context. Entities declared directly within |