diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index ba6dfa69f214d..da5ba90974293 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -68,7 +68,7 @@ class FileEntryRef { StringRef getNameAsRequested() const { return ME->first(); } const FileEntry &getFileEntry() const { - return *getBaseMapEntry().second->V.get(); + return *cast(getBaseMapEntry().second->V); } // This function is used if the buffer size needs to be increased @@ -361,7 +361,7 @@ bool FileEntryRef::isNamedPipe() const { return getFileEntry().isNamedPipe(); } void FileEntryRef::closeFile() const { getFileEntry().closeFile(); } void FileEntryRef::updateFileEntryBufferSize(unsigned BufferSize) { - getBaseMapEntry().second->V.get()->setSize(BufferSize); + cast(getBaseMapEntry().second->V)->setSize(BufferSize); } } // end namespace clang diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index ae9ebd9f59154..33d1cdb46f108 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -1012,7 +1012,7 @@ class Selector { } MultiKeywordSelector *getMultiKeywordSelector() const { - return InfoPtr.getPointer().get(); + return cast(InfoPtr.getPointer()); } unsigned getIdentifierInfoFlag() const { @@ -1020,7 +1020,7 @@ class Selector { // IMPORTANT NOTE: We have to reconstitute this data rather than use the // value directly from the PointerIntPair. See the comments in `InfoPtr` // for more details. - if (InfoPtr.getPointer().is()) + if (isa(InfoPtr.getPointer())) new_flags |= MultiArg; return new_flags; } diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index 22cbd0d90ee43..4fa5fbdb5a7f6 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -392,19 +392,17 @@ class ParsedAttr final } bool isArgExpr(unsigned Arg) const { - return Arg < NumArgs && getArg(Arg).is(); + return Arg < NumArgs && isa(getArg(Arg)); } - Expr *getArgAsExpr(unsigned Arg) const { - return getArg(Arg).get(); - } + Expr *getArgAsExpr(unsigned Arg) const { return cast(getArg(Arg)); } bool isArgIdent(unsigned Arg) const { - return Arg < NumArgs && getArg(Arg).is(); + return Arg < NumArgs && isa(getArg(Arg)); } IdentifierLoc *getArgAsIdent(unsigned Arg) const { - return getArg(Arg).get(); + return cast(getArg(Arg)); } const AvailabilityChange &getAvailabilityIntroduced() const { diff --git a/clang/include/clang/Sema/SemaConcept.h b/clang/include/clang/Sema/SemaConcept.h index 4b1abccb7741a..fa5309a597b3a 100644 --- a/clang/include/clang/Sema/SemaConcept.h +++ b/clang/include/clang/Sema/SemaConcept.h @@ -210,17 +210,17 @@ bool subsumes(const NormalForm &PDNF, const NormalForm &QCNF, bool Found = false; for (NormalFormConstraint Pia : Pi) { for (NormalFormConstraint Qjb : Qj) { - if (Pia.is() && - Qjb.is()) { - if (Pia.get()->subsumes( - *Qjb.get(), E)) { + if (isa(Pia) && + isa(Qjb)) { + if (cast(Pia)->subsumes( + *cast(Qjb), E)) { Found = true; break; } - } else if (Pia.is() && - Qjb.is()) { - if (E(*Pia.get(), - *Qjb.get())) { + } else if (isa(Pia) && + isa(Qjb)) { + if (E(*cast(Pia), + *cast(Qjb))) { Found = true; break; } diff --git a/clang/include/clang/Sema/SemaInternal.h b/clang/include/clang/Sema/SemaInternal.h index 41d05b2bfb078..27cda71989726 100644 --- a/clang/include/clang/Sema/SemaInternal.h +++ b/clang/include/clang/Sema/SemaInternal.h @@ -75,7 +75,7 @@ getDepthAndIndex(UnexpandedParameterPack UPP) { if (const auto *TTP = UPP.first.dyn_cast()) return std::make_pair(TTP->getDepth(), TTP->getIndex()); - return getDepthAndIndex(UPP.first.get()); + return getDepthAndIndex(cast(UPP.first)); } class TypoCorrectionConsumer : public VisibleDeclConsumer { diff --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h index 6872d04cc4dfb..9800f75f676aa 100644 --- a/clang/include/clang/Sema/Template.h +++ b/clang/include/clang/Sema/Template.h @@ -486,10 +486,10 @@ enum class TemplateSubstitutionKind : char { const Decl *D = I->first; llvm::PointerUnion &Stored = newScope->LocalDecls[D]; - if (I->second.is()) { - Stored = I->second.get(); + if (auto *D2 = dyn_cast(I->second)) { + Stored = D2; } else { - DeclArgumentPack *OldPack = I->second.get(); + DeclArgumentPack *OldPack = cast(I->second); DeclArgumentPack *NewPack = new DeclArgumentPack(*OldPack); Stored = NewPack; newScope->ArgumentPacks.push_back(NewPack); diff --git a/clang/lib/APINotes/APINotesManager.cpp b/clang/lib/APINotes/APINotesManager.cpp index 039d09fa7cf57..70d96c735503f 100644 --- a/clang/lib/APINotes/APINotesManager.cpp +++ b/clang/lib/APINotes/APINotesManager.cpp @@ -374,9 +374,9 @@ APINotesManager::findAPINotes(SourceLocation Loc) { ++NumDirectoryCacheHits; // We've been redirected to another directory for answers. Follow it. - if (Known->second && Known->second.is()) { + if (Known->second && isa(Known->second)) { DirsVisited.insert(*Dir); - Dir = Known->second.get(); + Dir = cast(Known->second); continue; } diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp index cbcfefdc52549..211e940ce8b86 100644 --- a/clang/lib/Analysis/ThreadSafetyCommon.cpp +++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp @@ -326,7 +326,7 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE, } assert(I == 0); - return Ctx->FunArgs.get(); + return cast(Ctx->FunArgs); } } // Map the param back to the param of the original function declaration diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index f44b5e4c4b638..f0b6f7be6c84f 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -324,9 +324,9 @@ llvm::Expected FileManager::getFileRef(StringRef Filename, *SeenFileEntries .insert({Status.getName(), FileEntryRef::MapValue(*UFE, DirInfo)}) .first; - assert(Redirection.second->V.is() && + assert(isa(Redirection.second->V) && "filename redirected to a non-canonical filename?"); - assert(Redirection.second->V.get() == UFE && + assert(cast(Redirection.second->V) == UFE && "filename from getStatValue() refers to wrong file"); // Cache the redirection in the previously-inserted entry, still available @@ -400,7 +400,7 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, FileEntryRef::MapValue Value = *NamedFileEnt.second; if (LLVM_LIKELY(isa(Value.V))) return FileEntryRef(NamedFileEnt); - return FileEntryRef(*Value.V.get()); + return FileEntryRef(*cast(Value.V)); } // We've not seen this before, or the file is cached as non-existent. @@ -620,7 +620,7 @@ void FileManager::GetUniqueIDMapping( for (const auto &Entry : SeenFileEntries) { // Only return files that exist and are not redirected. - if (!Entry.getValue() || !Entry.getValue()->V.is()) + if (!Entry.getValue() || !isa(Entry.getValue()->V)) continue; FileEntryRef FE(Entry); // Add this file if it's the first one with the UID, or if its name is diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 2deb91f27e37b..90809ef90858c 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -4085,7 +4085,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy, CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy); } else { assert(E && "Expected a non-null expression"); - LValue &PosLVal = *Pos.get(); + LValue &PosLVal = *cast(Pos); llvm::Value *Idx = CGF.EmitLoadOfScalar(PosLVal, E->getExprLoc()); Base = CGF.MakeAddrLValue( CGF.Builder.CreateGEP(CGF, DependenciesArray, Idx), KmpDependInfoTy); @@ -4113,7 +4113,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy, if (unsigned *P = Pos.dyn_cast()) { ++(*P); } else { - LValue &PosLVal = *Pos.get(); + LValue &PosLVal = *cast(Pos); llvm::Value *Idx = CGF.EmitLoadOfScalar(PosLVal, E->getExprLoc()); Idx = CGF.Builder.CreateNUWAdd(Idx, llvm::ConstantInt::get(Idx->getType(), 1)); diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index 19cff0398e21e..6c971bf0f381b 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -666,7 +666,7 @@ class IndexingDeclVisitor : public ConstDeclVisitor { Template = D->getSpecializedTemplateOrPartial(); const Decl *SpecializationOf = isa(Template) - ? (Decl *)Template.get() + ? (Decl *)cast(Template) : cast(Template); if (!D->isThisDeclarationADefinition()) IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), D);