diff --git a/clang/include/clang/Lex/PreprocessingRecord.h b/clang/include/clang/Lex/PreprocessingRecord.h index 437d8e4cc174e..7886aef7f0c7f 100644 --- a/clang/include/clang/Lex/PreprocessingRecord.h +++ b/clang/include/clang/Lex/PreprocessingRecord.h @@ -180,13 +180,13 @@ class Token; } /// True if it is a builtin macro. - bool isBuiltinMacro() const { return NameOrDef.is(); } + bool isBuiltinMacro() const { return isa(NameOrDef); } /// The name of the macro being expanded. const IdentifierInfo *getName() const { if (MacroDefinitionRecord *Def = getDefinition()) return Def->getName(); - return NameOrDef.get(); + return cast(NameOrDef); } /// The definition of the macro being expanded. May return null if diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 3312d4ed1d798..3d223c345ea15 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -859,7 +859,7 @@ class Preprocessor { auto *Info = State.dyn_cast(); if (!Info) { Info = new (PP.getPreprocessorAllocator()) - ModuleMacroInfo(State.get()); + ModuleMacroInfo(cast(State)); State = Info; } @@ -892,7 +892,7 @@ class Preprocessor { MacroDirective *getLatest() const { if (auto *Info = State.dyn_cast()) return Info->MD; - return State.get(); + return cast(State); } void setLatest(MacroDirective *MD) { @@ -945,7 +945,7 @@ class Preprocessor { if (Overrides.empty()) return; Info = new (PP.getPreprocessorAllocator()) - ModuleMacroInfo(State.get()); + ModuleMacroInfo(cast(State)); State = Info; } Info->OverriddenMacros.clear(); diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index 35472e705cfd8..5b14d138b6e28 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -484,10 +484,10 @@ SourceLocation PathDiagnosticLocation::getValidSourceLocation( // source code, so find an enclosing statement and use its location. if (!L.isValid()) { AnalysisDeclContext *ADC; - if (LAC.is()) - ADC = LAC.get()->getAnalysisDeclContext(); + if (auto *LC = dyn_cast(LAC)) + ADC = LC->getAnalysisDeclContext(); else - ADC = LAC.get(); + ADC = cast(LAC); ParentMap &PM = ADC->getParentMap(); diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 2876c290a26b1..f44b5e4c4b638 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -398,7 +398,7 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, {Filename, std::errc::no_such_file_or_directory}).first; if (NamedFileEnt.second) { FileEntryRef::MapValue Value = *NamedFileEnt.second; - if (LLVM_LIKELY(Value.V.is())) + if (LLVM_LIKELY(isa(Value.V))) return FileEntryRef(NamedFileEnt); return FileEntryRef(*Value.V.get()); } diff --git a/clang/lib/Index/FileIndexRecord.cpp b/clang/lib/Index/FileIndexRecord.cpp index f3a5e6b63bbc2..449c33637eb7e 100644 --- a/clang/lib/Index/FileIndexRecord.cpp +++ b/clang/lib/Index/FileIndexRecord.cpp @@ -65,7 +65,7 @@ void FileIndexRecord::print(llvm::raw_ostream &OS, SourceManager &SM) const { OS << ' ' << ND->getDeclName(); } } else { - const auto *MI = DclInfo.DeclOrMacro.get(); + const auto *MI = cast(DclInfo.DeclOrMacro); SourceLocation Loc = SM.getFileLoc(MI->getDefinitionLoc()); PresumedLoc PLoc = SM.getPresumedLoc(Loc); OS << llvm::sys::path::filename(PLoc.getFilename()) << ':' diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index a7fa6c5e6898e..19cff0398e21e 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -665,9 +665,9 @@ class IndexingDeclVisitor : public ConstDeclVisitor { ClassTemplatePartialSpecializationDecl *> Template = D->getSpecializedTemplateOrPartial(); const Decl *SpecializationOf = - Template.is() + isa(Template) ? (Decl *)Template.get() - : Template.get(); + : cast(Template); if (!D->isThisDeclarationADefinition()) IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), D); IndexCtx.indexTagDecl( diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index def4524449355..221f419861af1 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -5270,7 +5270,7 @@ CXString clang_getCursorSpelling(CXCursor C) { if (const OverloadExpr *E = Storage.dyn_cast()) return cxstring::createDup(E->getName().getAsString()); OverloadedTemplateStorage *Ovl = - Storage.get(); + cast(Storage); if (Ovl->size() == 0) return cxstring::createEmpty(); return cxstring::createDup((*Ovl->begin())->getNameAsString()); @@ -7309,7 +7309,7 @@ unsigned clang_getNumOverloadedDecls(CXCursor C) { Storage.dyn_cast()) return S->size(); - const Decl *D = Storage.get(); + const Decl *D = cast(Storage); if (const UsingDecl *Using = dyn_cast(D)) return Using->shadow_size(); @@ -7332,7 +7332,7 @@ CXCursor clang_getOverloadedDecl(CXCursor cursor, unsigned index) { Storage.dyn_cast()) return MakeCXCursor(S->begin()[index], TU); - const Decl *D = Storage.get(); + const Decl *D = cast(Storage); if (const UsingDecl *Using = dyn_cast(D)) { // FIXME: This is, unfortunately, linear time. UsingDecl::shadow_iterator Pos = Using->shadow_begin(); diff --git a/clang/tools/libclang/CIndexCXX.cpp b/clang/tools/libclang/CIndexCXX.cpp index ea6f97d39644e..a1be70dde9f67 100644 --- a/clang/tools/libclang/CIndexCXX.cpp +++ b/clang/tools/libclang/CIndexCXX.cpp @@ -101,11 +101,11 @@ CXCursor clang_getSpecializedCursorTemplate(CXCursor C) { llvm::PointerUnion Result = ClassSpec->getSpecializedTemplateOrPartial(); - if (Result.is()) - Template = Result.get(); + if (isa(Result)) + Template = cast(Result); else - Template = Result.get(); - + Template = cast(Result); + } else Template = CXXRecord->getInstantiatedFromMemberClass(); } else if (const FunctionDecl *Function = dyn_cast(D)) { diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index a9faba0d84403..72b3468dac486 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -362,7 +362,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic, if (auto *V = DiagsInPedantic.dyn_cast()) V->push_back(R); else - DiagsInPedantic.get()->insert(R); + cast(DiagsInPedantic)->insert(R); } if (!GroupsInPedantic) @@ -389,7 +389,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic, if (auto *V = GroupsInPedantic.dyn_cast()) V->push_back(Group); else - GroupsInPedantic.get()->insert(Group); + cast(GroupsInPedantic)->insert(Group); } }