Fix "pointer is null" static analyzer warning. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Jan 2020 17:10:35 +0000 (17:10 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Jan 2020 17:21:20 +0000 (17:21 +0000)
Use cast<> instead of dyn_cast<> since we know that the pointer should be valid (and is dereferenced immediately).

clang/lib/ARCMigrate/ObjCMT.cpp

index 4abb04f..8b3a4a3 100644 (file)
@@ -1092,7 +1092,7 @@ static bool AvailabilityAttrsMatch(Attr *At1, Attr *At2) {
   const AvailabilityAttr *AA1 = dyn_cast<AvailabilityAttr>(At1);
   if (!AA1)
     return true;
-  const AvailabilityAttr *AA2 = dyn_cast<AvailabilityAttr>(At2);
+  const AvailabilityAttr *AA2 = cast<AvailabilityAttr>(At2);
 
   VersionTuple Introduced1 = AA1->getIntroduced();
   VersionTuple Deprecated1 = AA1->getDeprecated();