aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaModule.cpp
diff options
context:
space:
mode:
authorVlad Serebrennikov <serebrennikov.vladislav@gmail.com>2023-11-02 20:57:29 +0400
committerGitHub <noreply@github.com>2023-11-02 20:57:29 +0400
commit8775947633bf189e1847707932b1015f04640ea0 (patch)
tree44e121ebf486cda5de36737d228ed9380d160d7c /clang/lib/Sema/SemaModule.cpp
parent8a3e4b5f32e6d333b6fa70aa6c505046ce18630f (diff)
downloadllvm-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/Sema/SemaModule.cpp')
-rw-r--r--clang/lib/Sema/SemaModule.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index 5582afb..8a29683 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -844,7 +844,7 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
// Don't diagnose anonymous union objects; we'll diagnose their members
// instead.
HasName = (bool)ND->getDeclName();
- if (HasName && ND->getFormalLinkage() == InternalLinkage) {
+ if (HasName && ND->getFormalLinkage() == Linkage::Internal) {
S.Diag(ND->getLocation(), diag::err_export_internal) << ND;
if (BlockStart.isValid())
S.Diag(BlockStart, diag::note_export);
@@ -858,9 +858,9 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
if (auto *USD = dyn_cast<UsingShadowDecl>(D)) {
NamedDecl *Target = USD->getUnderlyingDecl();
Linkage Lk = Target->getFormalLinkage();
- if (Lk == InternalLinkage || Lk == ModuleLinkage) {
+ if (Lk == Linkage::Internal || Lk == Linkage::Module) {
S.Diag(USD->getLocation(), diag::err_export_using_internal)
- << (Lk == InternalLinkage ? 0 : 1) << Target;
+ << (Lk == Linkage::Internal ? 0 : 1) << Target;
S.Diag(Target->getLocation(), diag::note_using_decl_target);
if (BlockStart.isValid())
S.Diag(BlockStart, diag::note_export);