diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp index 9e81a6bd19fc5b..df23735e4668ee 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp @@ -211,9 +211,9 @@ class MallocSizeofChecker : public Checker { continue; const TypeSourceInfo *TSI = nullptr; - if (CallRec.CastedExprParent.is()) { - TSI = CallRec.CastedExprParent.get() - ->getTypeSourceInfo(); + if (const auto *VD = + dyn_cast(CallRec.CastedExprParent)) { + TSI = VD->getTypeSourceInfo(); } else { TSI = CallRec.ExplicitCastType; } diff --git a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp index b0563b6c070f1f..827c04143e6588 100644 --- a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp +++ b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp @@ -196,13 +196,13 @@ const PointerToMemberData *BasicValueFactory::accumCXXBase( const NamedDecl *ND = nullptr; llvm::ImmutableList BaseSpecList; - if (PTMDT.isNull() || PTMDT.is()) { - if (PTMDT.is()) - ND = PTMDT.get(); + if (PTMDT.isNull() || isa(PTMDT)) { + if (const auto *NDP = dyn_cast_if_present(PTMDT)) + ND = NDP; BaseSpecList = CXXBaseListFactory.getEmptyList(); } else { - const PointerToMemberData *PTMD = PTMDT.get(); + const auto *PTMD = cast(PTMDT); ND = PTMD->getDeclaratorDecl(); BaseSpecList = PTMD->getCXXBaseList(); diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 1e0cc2eea9ed85..c4af02f21f4943 100644 --- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -211,9 +211,9 @@ void ExplodedNode::NodeGroup::replaceNode(ExplodedNode *node) { assert(!getFlag()); GroupStorage &Storage = reinterpret_cast(P); - assert(Storage.is()); + assert(isa(Storage)); Storage = node; - assert(Storage.is()); + assert(isa(Storage)); } void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { @@ -222,7 +222,7 @@ void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { GroupStorage &Storage = reinterpret_cast(P); if (Storage.isNull()) { Storage = N; - assert(Storage.is()); + assert(isa(Storage)); return; } @@ -230,7 +230,7 @@ void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { if (!V) { // Switch from single-node to multi-node representation. - ExplodedNode *Old = Storage.get(); + auto *Old = cast(Storage); BumpVectorContext &Ctx = G.getNodeAllocator(); V = new (G.getAllocator()) ExplodedNodeVector(Ctx, 4); @@ -238,7 +238,7 @@ void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { Storage = V; assert(!getFlag()); - assert(Storage.is()); + assert(isa(Storage)); } V->push_back(N, G.getNodeAllocator()); diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index ad4e43630dd44e..bbf2303b9f6ef3 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1068,10 +1068,10 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D, llvm::PointerUnion V = getStackOrCaptureRegionForDeclContext(LC, DC, D); - if (V.is()) - return V.get(); + if (const auto *VR = dyn_cast_if_present(V)) + return VR; - const auto *STC = V.get(); + const auto *STC = cast(V); if (!STC) { // FIXME: Assign a more sensible memory space to static locals diff --git a/clang/lib/StaticAnalyzer/Core/SVals.cpp b/clang/lib/StaticAnalyzer/Core/SVals.cpp index 84e7e033404c03..d009552965eca8 100644 --- a/clang/lib/StaticAnalyzer/Core/SVals.cpp +++ b/clang/lib/StaticAnalyzer/Core/SVals.cpp @@ -205,10 +205,10 @@ const NamedDecl *nonloc::PointerToMember::getDecl() const { return nullptr; const NamedDecl *ND = nullptr; - if (PTMD.is()) - ND = PTMD.get(); + if (const auto *NDP = dyn_cast(PTMD)) + ND = NDP; else - ND = PTMD.get()->getDeclaratorDecl(); + ND = cast(PTMD)->getDeclaratorDecl(); return ND; } @@ -227,16 +227,16 @@ nonloc::CompoundVal::iterator nonloc::CompoundVal::end() const { nonloc::PointerToMember::iterator nonloc::PointerToMember::begin() const { const PTMDataType PTMD = getPTMData(); - if (PTMD.is()) + if (isa(PTMD)) return {}; - return PTMD.get()->begin(); + return cast(PTMD)->begin(); } nonloc::PointerToMember::iterator nonloc::PointerToMember::end() const { const PTMDataType PTMD = getPTMData(); - if (PTMD.is()) + if (isa(PTMD)) return {}; - return PTMD.get()->end(); + return cast(PTMD)->end(); } //===----------------------------------------------------------------------===//