[Mlir-commits] [mlir] ae002f8 - Use isa instead of dyn_cast (NFC)

Kazu Hirata llvmlistbot at llvm.org
Mon Jul 25 23:01:13 PDT 2022


Author: Kazu Hirata
Date: 2022-07-25T23:00:58-07:00
New Revision: ae002f8bca11bf652fa4d2683c8a627fa77158a8

URL: https://github.com/llvm/llvm-project/commit/ae002f8bca11bf652fa4d2683c8a627fa77158a8
DIFF: https://github.com/llvm/llvm-project/commit/ae002f8bca11bf652fa4d2683c8a627fa77158a8.diff

LOG: Use isa instead of dyn_cast (NFC)

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
    mlir/lib/TableGen/Pattern.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 08fac9fb2e698..f12a0ee1fc6db 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -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();

diff  --git a/llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp b/llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
index e77c82e0fad9a..c91674426bbb0 100644
--- a/llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
+++ b/llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
@@ -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)

diff  --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp
index de767d6d3a6a1..d833de5100cc3 100644
--- a/mlir/lib/TableGen/Pattern.cpp
+++ b/mlir/lib/TableGen/Pattern.cpp
@@ -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 {


        


More information about the Mlir-commits mailing list