diff options
author | Kazu Hirata <kazu@google.com> | 2024-11-27 09:13:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-27 09:13:28 -0800 |
commit | 1e3e199ed9f214594e358eb0c7892cdedc703f7a (patch) | |
tree | 0f163d441f0132da378e14074f1f2383762b23ba /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 2f02b5af6ecb973d3a7faad9b0daff22646e724d (diff) | |
download | llvm-1e3e199ed9f214594e358eb0c7892cdedc703f7a.zip llvm-1e3e199ed9f214594e358eb0c7892cdedc703f7a.tar.gz llvm-1e3e199ed9f214594e358eb0c7892cdedc703f7a.tar.bz2 |
[Sema] Migrate away from PointerUnion::{is,get} (NFC) (#117498)
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 60ea138..1f398bb 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -131,8 +131,8 @@ private: } // Add the new element to the end of the vector. - DeclOrVector.get<DeclIndexPairVector *>()->push_back( - DeclIndexPair(ND, Index)); + cast<DeclIndexPairVector *>(DeclOrVector) + ->push_back(DeclIndexPair(ND, Index)); } ~ShadowMapEntry() { @@ -659,13 +659,13 @@ public: : DeclOrIterator(Iterator), SingleDeclIndex(0) {} iterator &operator++() { - if (DeclOrIterator.is<const NamedDecl *>()) { + if (isa<const NamedDecl *>(DeclOrIterator)) { DeclOrIterator = (NamedDecl *)nullptr; SingleDeclIndex = 0; return *this; } - const DeclIndexPair *I = DeclOrIterator.get<const DeclIndexPair *>(); + const DeclIndexPair *I = cast<const DeclIndexPair *>(DeclOrIterator); ++I; DeclOrIterator = I; return *this; @@ -681,7 +681,7 @@ public: if (const NamedDecl *ND = DeclOrIterator.dyn_cast<const NamedDecl *>()) return reference(ND, SingleDeclIndex); - return *DeclOrIterator.get<const DeclIndexPair *>(); + return *cast<const DeclIndexPair *>(DeclOrIterator); } pointer operator->() const { return pointer(**this); } @@ -705,15 +705,15 @@ ResultBuilder::ShadowMapEntry::begin() const { if (const NamedDecl *ND = DeclOrVector.dyn_cast<const NamedDecl *>()) return iterator(ND, SingleDeclIndex); - return iterator(DeclOrVector.get<DeclIndexPairVector *>()->begin()); + return iterator(cast<DeclIndexPairVector *>(DeclOrVector)->begin()); } ResultBuilder::ShadowMapEntry::iterator ResultBuilder::ShadowMapEntry::end() const { - if (DeclOrVector.is<const NamedDecl *>() || DeclOrVector.isNull()) + if (isa<const NamedDecl *>(DeclOrVector) || DeclOrVector.isNull()) return iterator(); - return iterator(DeclOrVector.get<DeclIndexPairVector *>()->end()); + return iterator(cast<DeclIndexPairVector *>(DeclOrVector)->end()); } /// Compute the qualification required to get from the current context |