Use isa instead of dyn_cast (NFC)

This commit is contained in:
Kazu Hirata 2022-07-25 23:00:58 -07:00
parent 2789c4f51c
commit ae002f8bca
3 changed files with 6 additions and 6 deletions

View File

@ -908,7 +908,7 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
// values are properly placed inside the required region, however if an
// initializer list is used, this doesn't happen automatically.
auto *Init = CNE->getInitializer();
bool isInitList = dyn_cast_or_null<InitListExpr>(Init);
bool isInitList = isa_and_nonnull<InitListExpr>(Init);
QualType ObjTy =
isInitList ? Init->getType() : CNE->getType()->getPointeeType();

View File

@ -292,7 +292,7 @@ using DebugInfoBits = SmallString<10000>;
static Error addSectionsFromLinkedData(objcopy::ConfigManager &Config,
ObjectFile &InputFile,
DebugInfoBits &LinkedDebugInfoBits) {
if (dyn_cast<ELFObjectFile<ELF32LE>>(&InputFile)) {
if (isa<ELFObjectFile<ELF32LE>>(&InputFile)) {
Expected<ELFObjectFile<ELF32LE>> MemFile = ELFObjectFile<ELF32LE>::create(
MemoryBufferRef(LinkedDebugInfoBits, ""));
if (!MemFile)
@ -300,7 +300,7 @@ static Error addSectionsFromLinkedData(objcopy::ConfigManager &Config,
if (Error Err = setConfigToAddNewDebugSections(Config, *MemFile))
return Err;
} else if (dyn_cast<ELFObjectFile<ELF64LE>>(&InputFile)) {
} else if (isa<ELFObjectFile<ELF64LE>>(&InputFile)) {
Expected<ELFObjectFile<ELF64LE>> MemFile = ELFObjectFile<ELF64LE>::create(
MemoryBufferRef(LinkedDebugInfoBits, ""));
if (!MemFile)
@ -308,7 +308,7 @@ static Error addSectionsFromLinkedData(objcopy::ConfigManager &Config,
if (Error Err = setConfigToAddNewDebugSections(Config, *MemFile))
return Err;
} else if (dyn_cast<ELFObjectFile<ELF32BE>>(&InputFile)) {
} else if (isa<ELFObjectFile<ELF32BE>>(&InputFile)) {
Expected<ELFObjectFile<ELF32BE>> MemFile = ELFObjectFile<ELF32BE>::create(
MemoryBufferRef(LinkedDebugInfoBits, ""));
if (!MemFile)
@ -316,7 +316,7 @@ static Error addSectionsFromLinkedData(objcopy::ConfigManager &Config,
if (Error Err = setConfigToAddNewDebugSections(Config, *MemFile))
return Err;
} else if (dyn_cast<ELFObjectFile<ELF64BE>>(&InputFile)) {
} else if (isa<ELFObjectFile<ELF64BE>>(&InputFile)) {
Expected<ELFObjectFile<ELF64BE>> MemFile = ELFObjectFile<ELF64BE>::create(
MemoryBufferRef(LinkedDebugInfoBits, ""));
if (!MemFile)

View File

@ -33,7 +33,7 @@ using llvm::formatv;
//===----------------------------------------------------------------------===//
bool DagLeaf::isUnspecified() const {
return dyn_cast_or_null<llvm::UnsetInit>(def);
return isa_and_nonnull<llvm::UnsetInit>(def);
}
bool DagLeaf::isOperandMatcher() const {