diff options
author | Krystian Stasiowski <sdkrystian@gmail.com> | 2024-07-15 13:57:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 13:57:56 -0400 |
commit | e6ec7c8f74d1be778f4ddf794d0e2fb63b0dc3be (patch) | |
tree | d4e341f33bd7961952e31173a1fb769fdf16d12d /clang/lib/Sema/SemaLookup.cpp | |
parent | 290537238b45106e30bb082b9affde345d8a5482 (diff) | |
download | llvm-e6ec7c8f74d1be778f4ddf794d0e2fb63b0dc3be.zip llvm-e6ec7c8f74d1be778f4ddf794d0e2fb63b0dc3be.tar.gz llvm-e6ec7c8f74d1be778f4ddf794d0e2fb63b0dc3be.tar.bz2 |
[Clang][AST] Move NamespaceDecl bits to DeclContext (#98567)
Currently, `NamespaceDecl` has a member `AnonOrFirstNamespaceAndFlags`
which stores a few pieces of data:
- a bit indicating whether the namespace was declared `inline`, and
- a bit indicating whether the namespace was declared as a
_nested-namespace-definition_, and
- a pointer a `NamespaceDecl` that either stores:
- a pointer to the first declaration of that namespace if the
declaration is no the first declaration, or
- a pointer to the unnamed namespace that inhabits the namespace
otherwise.
`Redeclarable` already stores a pointer to the first declaration of an
entity, so it's unnecessary to store this in `NamespaceDecl`.
`DeclContext` has 8 bytes in which various bitfields can be stored for a
declaration, so it's not necessary to store these in `NamespaceDecl`
either. We only need to store a pointer to the unnamed namespace that
inhabits the first declaration of a namespace. This patch moves the two
bits currently stored in `NamespaceDecl` to `DeclContext`, and only
stores a pointer to the unnamed namespace that inhabits a namespace in
the first declaration of that namespace. Since `getOriginalNamespace`
always returns the same `NamespaceDecl` as `getFirstDecl`, this function
is removed to avoid confusion.
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 7851c5d..7a6a645 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2325,7 +2325,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, // We have already looked into the initial namespace; seed the queue // with its using-children. for (auto *I : StartDC->using_directives()) { - NamespaceDecl *ND = I->getNominatedNamespace()->getOriginalNamespace(); + NamespaceDecl *ND = I->getNominatedNamespace()->getFirstDecl(); if (S.isVisible(I) && Visited.insert(ND).second) Queue.push_back(ND); } |